By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

String trouble

P: 6
I'm need my program to read the entire first line from a program. and then write it to an output file.

ex: Men's Track Meet

thus far i can only get it to read Men's

this is using the C++ language

Nov 5 '06 #1
Share this Question
Share on Google+
4 Replies

P: 94
try using getline(). I recently encountered a similar situation. getline() worked perfectly.
Nov 5 '06 #2

P: 6
Thanks worked perfectly, but i've got another problem.

Sample input:

Men's track Results
1999 Danbury 30 Trinity Catholic 35
2000 Ridgefield 80 Staples High School 50

I want my program to read the year, and then the names of the schools and ignore the scores. The trouble i'm having is with the names of the schools being more then one word.

thanks again
Nov 6 '06 #3

P: 94
the only thing i can think of at the moment is ignore(). But I am not sure if you can use that because you want to keep the year..
Nov 6 '06 #4

P: 6
okay i want to keep the scores as well, but the problem is i'm having trouble with schools whose name is longer then one word.
Nov 6 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.