Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Are they expected to accomplish more? Multitasking?

Answered: 1 week ago

Question

2. How will the team select a leader?

Answered: 1 week ago