Can some one help me with this.I have a project and I have a file with the list off all the presidents from Washington to Obama it looks like
WASHINGTON,GEORGE
ADAMS,JOHN
JEFFERSON,THOMAS
MADISON,JAMES
MONROE,JAMES
ADAMS,JOHN_QUINCY
and so on.
What I need to do is make a list that shows the name of the president. Which number they were in order and which president is next. for example
0 2 adams,John 22
the 22 so it can show which president is next by that first column and and the first one is just in order from 0-50. This is what I have
can some one help me with the output? im not getting anything. When I debug it, it shows nothing being taken in. I am using cstyle string. We can change if need be.
You haven't read a line in from the file. You need to do something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
fin.open("prez.dat");
fout.open("list.txt");
int n=0;
string line;
while(!fin.eof())
{
std::getline (fin, line);
plist[n] = new president();
// parse the line variable by whatever it is delimited by
// and then place these into the plist[n] structure
n++;
}