|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have these two structs
struct BookInfoType { apstring Title; apstring Author; apstring ISBN; apstring PubName; int PubYear; }; struct Book { int number; apvector<BookInfoType> list; }; the problem comes when I try to enter the data (which is in a text file with spaces in the name such as Mr. John etc.) how do I use the getline thing in struct to ignore spaces. so far I have this: void getData(Book &data) { ifstream infile("data.txt", ios::in); infile >> data.number; data.list.resize(data.number); int i = 0; while((!infile.eof() && i < data.number)) { getline(infile, data.list[i].Title); infile >> data.list[i].Title; infile >> data.list[i].PubYear; infile >> data.list[i].ISBN; i++; } } ------------- Please help!!! I am stumped. If I glue the names together it comes fine, but I need to show the spaces in the cout. |
|
#2
|
|||
|
|||
|
heres the whole program
PHP Code:
------------- HELP I am screwed. I have finals and I need to know how to do this. I have searched all over the internet without finding an example of this. Last edited by rpgwh : May 22nd, 2003 at 11:48 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > AP Computer Science Help - Structs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|