- #1
burton95
- 54
- 0
Basically I want to take an unknown amount of variables and sum them up. I'm sure it's simple. I know there is some way to tell VS to keep reading the opened stream from my numbers.txt file.
Before I just knew the number of variables and would declare them and read them in seperatley and sum them up. How do I say "When no more int's are left in the "numbers.txt" file quite reading and then sum them up??
Anthony
Code:
#include <iostream>
#include <fstream>
using namespace std;
ifstream data_input;
data_input.open("numbers.txt");
...
Before I just knew the number of variables and would declare them and read them in seperatley and sum them up. How do I say "When no more int's are left in the "numbers.txt" file quite reading and then sum them up??
Anthony