- Joined
- Mar 26, 2012
- Messages
- 1,465
- Reaction score
- 131
Can you clarify - what is the exact output you're getting right now?the only result I get is subtraction of the letters and not a output of what I want
if(m_nLevel > 99)
{
CString strName;
strName = szName;
if(m_nLevel == 100)
{
strName += " *Amara* 1";
}
if(m_nLevel == 101)
{
strName += " *Amara* 2";
}
if(m_nLevel == 102)
{
strName += " *Amara* 3";
}
if(m_nLevel == 103)
{
strName += " *Amara* 4";
}
if(m_nLevel == 104)
{
strName += " *Amara* 5";
}
if(m_nLevel == 105)
{
strName += " *Amara* 6";
}
if(m_nLevel == 106)
{
strName += " *Amara* 7";
}
if(m_nLevel == 107)
{
strName += " *Amara* 8";
}
if(m_nLevel == 108)
{
strName += " *Amara* 9";
}
if(m_nLevel == 109)
{
strName += " *Amara* 10";
}
if(m_nLevel == 110)
{
strName += " *Amara* 11";
}
if(m_nLevel == 111)
{
strName += " *Amara* 12";
}
if(m_nLevel == 112)
{
strName += " *Amara* 13";
}
if(m_nLevel == 113)
{
strName += " *Amara* 14";
}
if(m_nLevel == 114)
{
strName += " *Amara* 15";
}
if(m_nLevel == 115)
{
strName += " *Amara* 16";
}
if(m_nLevel == 116)
{
strName += " *Amara* 17";
}
if(m_nLevel == 117)
{
strName += " *Amara* 18";
}
if(m_nLevel == 118)
{
strName += " *Amara* 19";
}
if(m_nLevel == 119)
{
strName += " *Amara* 20";
}
if(m_nLevel == 120)
{
strName += " *Amara* 21";
}
if(m_nLevel == 121)
{
strName += " *Amara* 22";
}
if(m_nLevel == 122)
{
strName += " *Amara* 23";
}
if(m_nLevel == 123)
{
strName += " *Amara*24";
}
if(m_nLevel == 124)
{
strName += " *Amara* 25";
}
if(m_nLevel == 125)
{
strName += " *Amara* 26";
}
if(m_nLevel == 126)
{
strName += " *Amara* 27";
}
if(m_nLevel == 127)
{
strName += " *Amara* 28";
}
if(m_nLevel == 128)
{
strName += " *Amara* 29";
}
if(m_nLevel == 129)
{
strName += " *Amara* 30";
}
if(m_nLevel == 130)
{
strName += " *Amara* 31";
}
if(m_nLevel == 131)
{
strName += " *Amara* 32";
}
if(m_nLevel == 132)
{
strName += " *Amara* 33";
}
if(m_nLevel == 133)
{
strName += " *Amara* 34";
}
if(m_nLevel == 134)
{
strName += " *Amara* 35";
}
if(m_nLevel == 135)
{
strName += " *Amara* 36";
}
if(m_nLevel == 136)
{
strName += " *Amara* 37";
}
if(m_nLevel == 137)
{
strName += " *Amara* 38";
}
if(m_nLevel == 138)
{
strName += " *Amara* 39";
}
if(m_nLevel == 139)
{
strName += " *Amara* 40";
}
if(m_nLevel == 140)
{
strName += " *Eda* 1";
}
if(m_nLevel == 141)
{
strName += " *Eda* 2";
}
if(m_nLevel == 142)
{
strName += " *Eda* 3";
}
if(m_nLevel == 143)
{
strName += " *Eda* 4";
}
if(m_nLevel == 144)
{
strName += " *Eda* 5";
}
if(m_nLevel == 145)
{
strName += " *Eda* 6";
}
if(m_nLevel == 146)
{
strName += " *Eda* 7";
}
if(m_nLevel == 147)
{
strName += " *Eda* 8";
}
if(m_nLevel == 148)
{
strName += " *Eda* 9";
}
if(m_nLevel == 149)
{
strName += " *Eda* 10";
}
if(m_nLevel == 150)
{
strName += " *Eda* 11";
}
if(m_nLevel == 151)
{
strName += " *Eda* 12";
}
if(m_nLevel == 152)
{
strName += " *Eda* 13";
}
if(m_nLevel == 153)
{
strName += " *Eda* 14";
}
if(m_nLevel == 154)
{
strName += " *Eda* 15";
}
if(m_nLevel == 155)
{
strName += " *Eda* 16";
}
if(m_nLevel == 156)
{
strName += " *Eda* 17";
}
if(m_nLevel == 157)
{
strName += " *Eda* 18";
}
if(m_nLevel == 158)
{
strName += " *Eda* 19";
}
if(m_nLevel == 159)
{
strName += " *Eda* 20";
}
if(m_nLevel == 160)
{
strName += " *Eda* 21";
}
if(m_nLevel == 161)
{
strName += " *Eda* 22";
}
if(m_nLevel == 162)
{
strName += " *Eda* 23";
}
if(m_nLevel == 163)
{
strName += " *Eda*24";
}
if(m_nLevel == 164)
{
strName += " *Eda* 25";
}
if(m_nLevel == 165)
{
strName += " *Eda* 26";
}
if(m_nLevel == 166)
{
strName += " *Eda* 27";
}
if(m_nLevel == 167)
{
strName += " *Eda* 28";
}
if(m_nLevel == 168)
{
strName += " *Eda* 29";
}
if(m_nLevel == 169)
{
strName += " *Eda* 30";
}
if(m_nLevel == 170)
{
strName += " *Eda* 31";
}
if(m_nLevel == 171)
{
strName += " *Eda* 32";
}
if(m_nLevel == 172)
{
strName += " *Eda* 33";
}
if(m_nLevel == 173)
{
strName += " *Eda* 34";
}
if(m_nLevel == 174)
{
strName += " *Eda* 35";
}
if(m_nLevel == 175)
{
strName += " *Eda* 36";
}
if(m_nLevel == 176)
{
strName += " *Eda* 37";
}
if(m_nLevel == 177)
{
strName += " *Eda* 38";
}
if(m_nLevel == 178)
{
strName += " *Eda* 39";
}
if(m_nLevel == 179)
{
strName += " *Eda* 40";
}
if(m_nLevel == 180)
{
strName += " *Astica* 1";
}
if(m_nLevel == 181)
{
strName += " *Astica* 2";
}
if(m_nLevel == 182)
{
strName += " *Astica* 3";
}
if(m_nLevel == 183)
{
strName += " *Astica* 4";
}
if(m_nLevel == 184)
{
strName += " *Astica* 5";
}
if(m_nLevel == 185)
{
strName += " *Astica* 6";
}
if(m_nLevel == 186)
{
strName += " *Astica* 7";
}
if(m_nLevel == 187)
{
strName += " *Astica* 8";
}
if(m_nLevel == 188)
{
strName += " *Astica* 9";
}
if(m_nLevel == 189)
{
strName += " *Astica* 10";
}
if(m_nLevel == 190)
{
strName += " *Astica* 11";
}
if(m_nLevel == 191)
{
strName += " *Astica* 12";
}
if(m_nLevel == 192)
{
strName += " *Astica* 13";
}
if(m_nLevel == 193)
{
strName += " *Astica* 14";
}
if(m_nLevel == 194)
{
strName += " *Astica* 15";
}
if(m_nLevel == 195)
{
strName += " *Astica* 16";
}
if(m_nLevel == 196)
{
strName += " *Astica* 17";
}
if(m_nLevel == 197)
{
strName += " *Astica* 18";
}
if(m_nLevel == 198)
{
strName += " *Astica* 19";
}
if(m_nLevel == 199)
{
strName += " *Astica* 20";
}
if(m_nLevel == 200)
{
strName += " *Astica* 21";
}
strcpy(szName, (LPCTSTR)strName);
}
LPCTSTR szName = _T("Hello");
CString strName = szName;
int m_nLevel = 120; // 100 ~ 139
int b = m_nLevel - 99;
strName.Format(_T("%s *Amara*%d"), szName, b);
szName = (LPCTSTR)strName;
std::wcout << szName << std::endl; // Hello *Amara*21
CString to_CString(int nValue)
{
// Convert int to zero terminated string for CString
}
CString to_CString(short nValue)
{
// Convert short to zero terminated string for CString
}
CString to_CString(long long nValue)
{
// Convert long long to zero terminated string for CString
}
CString to_CString(float nValue)
{
// Convert float to zero terminated string for CString
}
CString to_CString(double nValue)
{
// Convert double to zero terminated string for CString
}
// other functions to be converted
void operator+=(CString& left, const char* right)
{
// handle operator +=
}
void operator+=(CString& left, CString& right)
{
// handle operator +=
}
void operator+=(CString& left, CString&& right)
{
operator+=(left, right);
}
CString operator+(const char* left, CString& right)
{
// handle operator+
}
CString operator+(CString& left, CString& right)
{
// handle operator+
}
CString operator+(CString& left, CString&& right)
{
return operator+(left, right);
}
CString operator+(CString&& left, CString& right)
{
return operator+(left, right);
}
CString operator+(CString&& left, CString&& right)
{
return operator+(left, right);
}
if (m_nLevel > 99 && m_nLevel < 140) {
int i = m_nLevel; // Initialization expression
string k = std::to_string(m_nLevel - 99);
string l = "Amara" + k;
int j = m_nLevel + 1;
do
{
// loop body
strName += l.c_str();
//cout << "Hello World\n";
// update expression
i++;
} //while (i < 140); // test expression
while (i < j);
}
Isn't there a loop function that might do the same thing? Maybe I am overthinking this somehow.
By golly I think I got it now. LOL
if (m_nLevel > 99 && m_nLevel < 140) {
int level = m_nLevel;
string k = std::to_string(m_nLevel - 99);
string l = "Amara" + k;
int displayLevel = m_nLevel + 1;
do {
strName += l.c_str();
level++;
} while (level < displayLevel);
}
if (m_nLevel > 99 && m_nLevel < 140) {
std::string k = std::to_string(m_nLevel - 99);
strName += std::string("Amara " + k).c_str();
}