#include <iostream> #include <fstream> using namespace std; int main() { int num
ID: 3615489 • Letter: #
Question
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int num, sum = 0, i = 0;
ifstream infile;
infile.open ("infile-5-B-2.txt");
cout << “ Please enter any number ofintegers from the Standard Input (Keyboard) until the User inputsan x” << endl;
cout << "Reading data from file"infile-5-B-2.txt"" << endl << endl;
infile >> num;
while (infile)
{
cout << num << " ";
sum = sum + num;
i++;
infile >> num;
}
cout << endl << "Sum ofintegers " << sum << endl;
cout << "Number of integers "<< i << endl ;
if (i != 0)
cout <<"Average of integers " << (double)sum / i << endl ;
cout << endl ;
infile.close();
system("PAUSE");
return 0;
}