| weezy08 (2) | |
|
So I'm making a file that calculates the total score for an individual student. the end of my linefeed will be -1. the first line determines the possible points and the rest of the lines are data for a particular student. There isn't a limit on how many student data the program can read. so i figured out the first line feed I'm just stuck on how the program will read each student data until it reaches the last one. and where do i calculate the percentage, whenever i check it, it always comes out as 0. Any help will be great! thanks! Part of program. cin >> number; while (number != -1) { ctotal = ctotal + number; cin >> number; } cin >> c1 >> c2 >> c3 >> c4; cin >> data; while (data != -1) { stotal = stotal + data; cin >> data; } per = (stotal / ctotal) * 100; | |
|
|
|
| JLBorges (1336) | |||
| |||
|
|
|||
| dangerous (13) | |
| ctotal should be initialized. | |
|
|
|