Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Don\'t need finished code of it done, just need an explination of how to do it.

ID: 3542323 • Letter: D

Question

Don't need finished code of it done, just need an explination of how to do it. I need to write a program that takes data from a input line and puts different peices of the line into different variables. Basically like a grading program where if someone input the line "Mark 89 85" it would store mark under the name variable, 89 under the test 1 variable, and 85 under the test 2 variable. I know how to do this if I had to input each thing in 3 different times in 3 different input cases, but not how to seperate all 3 from the same line. Can somone please explain?

Explanation / Answer

Using file in C++:


int i = 0;

ifstream myFile("input.txt");

string name[3];

int test1[3];

int test2[3];


while(!myFile.eof()){

myFile >> name[i] >> test1[i] >> test2[i];

i++;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote