hi, can someone help me on the problem that i had:
Problem:
the string output is:4488118417,
and i split it to two: 44 88 11 84 17,
and how can i make 44 in one string, usually 44 is str[0] and str[1].
for example
str[0]=44
str[1]=88
str[2]=11
str[3]=84
str[4]=17
This is the code that i stuck with:
Code:
stringstream numbers;
/* Insert integer into stringstream*/
numbers <<numLowerCaseLetter(name)<<sumAscii(name)<<lastValue<<counter<<sum;
/* Convert stringstream into string.*/
string str = numbers.str();
if(str.size() % 2 == 0)
{
for(int i = 0; i < str[i]; i=i+2)
{
cout<<str.substr(i,2)<<" ";
}
}
else
{
str.size()+1;
str.append( 1, '0' );
for(int i = 0; i < str[i]; i=i+2)
{
cout<<str.substr(i,2)<<" ";
}