#include<iostream> #include <string> #include <fstream> #include <iomanip> using
ID: 3610848 • Letter: #
Question
#include<iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
const int SIZE = 25;//Size of arrays
int main()
{
double SalesAmounts [SIZE]; //Sales amounts array
string SalesReps [SIZE]; //Names of sales representativesarray
ifstream infile; //Input filestream variable
string fnameopen, fnameclose; //Variables to hold actualname of file
double sum;
int counter; //used in for loops
double average; //average of sales amount
cout<<"Pleaseenter name of input file"<<endl;
cin>>fnameopen;
infile.open(fnameopen.c_str());
cout<<"Please enter name of outputfile"<<endl;
cin>>fnameclose;
sum = 0;
for (counter=0; counter<SIZE; counter++)
{
cin>>SalesAmounts[counter];
sum = sum +SalesAmounts[counter];
average = sum/SIZE;
}
cout<<fixed<<showpoint<<setprecision(2);
cout<<"Average slaes: "<<setw(7)<<"$"
<<setw(7)<<average<<endl;