Assume that the following data is stored in file “data.txt”: 2 5 7 1 12 -999 1 4 11 55 66 3 43 23 -999 9 87 56 34 22 12 21 -999 8 7 5 4 6 111 -999 The number -999 at the end of each line acts as a sentinel value and is not part of the data. Write a C++ program that reads these numbers from a file of unspecified length, calculates and displays the sum of all numbers in each line. |
"I CANNOT SEE THE FILE " |
|
|
|
|
|
|
@abbzi I'm sorry, I can't really understand your code, and I've tried it but the debugging gives me a blank black window ! |
Assume that the following data is stored in file “data.txt”: 2 5 7 1 12 -999 1 4 11 55 66 3 43 23 -999 9 87 56 34 22 12 21 -999 8 7 5 4 6 111 -999 The number -999 at the end of each line acts as a sentinel value and is not part of the data. Write a C++ program that reads these numbers from a file of unspecified length, calculates and displays the sum of all numbers in each line. |
|
|