Hello, I\'m still learning the basics of c++ and I\'m stuck on this program I\'m
ID: 3528747 • Letter: H
Question
Hello, I'm still learning the basics of c++ and I'm stuck on this program I'm currently working on. I'm given a list of students from a .dat file and I need to pull out the information to input it in my program. Here's an example of the data from the file. Jocelyn Dominguez is from KY, sophomore expected to graduate in 2016 I will need to pull out the first and last name, and the grade year (sophomore). My teacher has put the comma there as a hint for us, but I do not know the correct coding to retrieve that. What I figured to pull out the first two names are. (I have everything correctly declared in my program.) inData >> firstName >> lastName; cout << firstName << lastName <<endl; I know we have to use an ignore statement to retrieve the word after the comma, but how do I exactly do that? Thankyou -LeonExplanation / Answer
input stops after a blanks space character is detected, so
inData>> firstName >>lastName >>fake1>>fake1>>schoolNameWithComma>>Type>>fake1>>fake1>>fake1>>fake1>>GradYear;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.