mardi 24 mars 2015

How to use substr from right hand side to left hand side? How to convert each 8 characters from a string to an int?


I have this code:



#include<iostream>
#include<string>
using namespace std;
int main()
{
int i=o;
string str="12345678910111213141516171819202122232425262728293";
while(i<str.length())
{
cout<<str.substr(i,8)<<endl;
i+i+8;
return 0;
}


/My output is: 12345678 91011121 31415161 ....... I want to get 8 characters from right to left instead of fro left to right. Then, each 8 characters received need to be inserted into an integer variable. Please, can anyone help?/




Aucun commentaire:

Enregistrer un commentaire