so I been trying to print 2D array using forloop
but if I print and see the result (each number is each line)
1
12
123
1234
12345
123456
1234567
12345678
123456789
its not printing line by line its printing first line and add extra line to it when it print.
I thought it was string stream problem so I tried
clear; empty; s.str(""); stringstream().swap(s);
but none of these worked.
while(getline(file1,line1))
{
stringstream s(line1);
while(getline(s,word,','))
{
student.push_back(word);
}
stack.push_back(student);
s.str("");
}
file1.close();
for (int i = 0; i < stack.size(); i++)
{
for (int j = 0; j < stack[i].size(); j++)
{
cout << stack[i][j];
}
cout << endl;
}
this is my coding to copy in informations from csv file.
I expect output to be
1
2
3
4
5
6
7
8
9