Question: Need help redirecting my output to a file , cant seem to get the print to redirect to a file. #include #include #include using namespace

Need help redirecting my output to a file , cant seem to get the print to redirect to a file.

#include #include #include using namespace std; int subject[100]; double average[100]; double daysexercise[100]; double est_maximum[100]; double ratio1[100]; double ratio2[100]; int c=0; void getdata(ifstream &in) { int maximum; int age; double sum=0; // Read file while(!in.eof()) { double aver[5]; double maxi[5]; double exe[5]; // First line in>>subject[c]; in>>maximum; in>>age; // Next 5 lines read to array for(int i=0;i<5;i++) { in>>aver[i]; in>>maxi[i]; in>>exe[i]; } int cou=0; // Average calculation for(int i=0;i<5;i++) { if(aver[i]==-1) sum=sum+0; else { sum=sum+aver[i]; cou++; } } double avg=sum/cou; average[c]=avg; cou=0; // Number of days exercised for(int i=0;i<5;i++) { if(exe[i]!=0)cou++; } daysexercise[c]=cou; // Estimated maximum est_maximum[c]=220-age; // Ratio Calculation ratio1[c]=(maximum/est_maximum[c])*100; double max=0; // Find maximum value in the array for(int i=0;i<5;i++) { if(maxi[i]>max) max=maxi[i]; } // Ratio Calculation ratio2[c]=(max/maximum)*100; c++; } } void print(int subjectSorted[] ) { cout<< "COMMUTING AND EXERCISE HEART RATE SUMMARY"<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!