i'm trying to create an Exam Results Information program that get its inputs from input.txt, calculate, and display the output to output.txt ..i encounter problem with the full name though..my code will work if the names in the input.txt is only 1 word instead of full name..
in the input.txt for example have:
Alissa (Name) 134322523 (ID) 8 (No. of Subject) 32(total credits)
if i write 'Alissa', program will run and display the name
but if i write 'Alissa Macmillan'...output will display exponential numbers and stuff..
how to get the program to read and display the full name in the input.txt?
with the operator>> you're using whitespace (' ', '\t', '\n') as a separator. Hence only the first part of the name is read and ID[counter] gets the second part and so on
I suggest that you use newline ('\n') when writing the separator. To read the entire name you could use getline: