Using getline with input file

Okay so i have an input file that is formatted like this (spaces are arbitrary)

Adam Zeller 452313 78 86 91 64 90 76
Barbara Young 274253 88 77 91 66 82 93
Carl Wilson 112235 87 99 76 93 95 94

i am to read this info into different char arrays and then do stuff like drop lowest score, average and, calculate the total number of letter grades.

output should look like this

Last_name First_name ID Average_Score Grade
Zeller Adam 452313 82.3 B
Young Barbara 274253 86.2 B
Wilson Carl 112235 93.6 A
Grade Totals:
A – 1
B - 2

My question is, how do I use getline to read in the info into the different char arrays? i have never had to use getline up until now and since we can use fin >> im a little confused.
not asking for the whole code just how to use getline to get the info in the array... and i know i need to use delimeters, such as spaces or new lines '\n'
Last edited on

(or use stringstreams which do a better job, but my guess is that might be too heavy - but feel free)
Registered users can post here. Sign in or register to post.