Hello I need help with this simple C++ program.
Write a program to calculate the average of a set of integer values placed in an input file called “data.txt”; you may create your own input file. We however do not know the number of values listed in this input file and your program should be written in a way to handle any file. Make sure to submit your input file in addition to a copy of the program and its output.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream in("data.txt");
if (in.is_open()) {
double total = 0, count = 0, num;
while (in >> num) {
total += num;
++count;
}
cout << "Average of all numbers in file is " << total / count << endl;
in.close();
} else {
cout << "data.txt does not exists!" << endl;
}
return 0;
}

7 9 1 5

Average of all numbers in file is 5.5
Hello I need help with this simple C++ program. Write a program to calculate the average...