adding numbers(integers) from a .txt file
Hey guys
How do you add numbers(integers) from a .txt file and then output it on C++.
Note: each number is on a separate line yet are under the same heading
Thanks
1. Set the sum to zero
2. Open the file
3. While you can read a number
3.1. Add the number to the sum
4. Close the file
5. Print the sum.
Use an ifstream exactly as if it were cin.
Hope this helps.
Topic archived. No new replies allowed.