#include <iostream>
#include <string>
#include <sstream>
usingnamespace std;
int main()
{
int a = 100;
int b = 100;
int producto;
string numero;
stringstream convertir;
while (a < 1000)
{
for (;b < 1000; b++)
{
producto = a*b;
convertir << producto;
numero = convertir.str();
cout << numero << endl;
}
a++;
b = 100;
}
return 0;
}
but apparently -- convertir << producto -- appends the next data right besides the one that was already there. After three cycles, convertir holds this value:
100001010010200
What I would like to do is to empty this stringstream in order to analyze each result separately.
I had used convertir.str() = "" , but now I see the difference. I still have a hard time reading the references, mainly because I don't have a full grasp on the terminology yet.