#include <iostream> #include <fstream>using namespace std;int main(int argc, char const *argv[]) { int total = 0, max = 0; ifstream input; input.open ("Data.txt"); while ((!input.eof()) && (total < 5555)) { int temp; input >> temp; total += temp; if (temp > max) max = temp; } input.close (); cout << "Total: " << total << endl; cout << "Maximum: " << max << endl; return 0; }
Comments