Question: Please help me fix this following C++ code #include #include #include using namespace std; void readData(string names[], int scores[][7]){ ifstream infile(ch8_Ex12Data.txt); int i,j; for(i=0;i infile

Please help me fix this following C++ code

#include

#include

#include

using namespace std;

void readData(string names[], int scores[][7]){

ifstream infile("ch8_Ex12Data.txt");

int i,j;

for(i=0;i

infile >> names[i];

for(j=0;j

infile >> scores[i][j];

}

}

infile.close();

}

void average_miles(int scores[][7], float averages[]){

int i,j;

for(i=0;i

double sum = 0;

for(j=0;j

sum += scores[i][j];

}

float average = sum/7.0;

averages[i] = average;

}

}

void outputData(string names[], int scores[][7], float averages[]){

cout

int i,j;

cout

for(i=0;i

cout

for(j=0;j

cout

}

cout

}

}

int main(){

string names[5];

int scores[5][7];

float averages[5];

readData(names, scores);

average_miles(scores, averages);

outputData(names, scores, averages);

return 0;

}

//

ch8_Ex12Data.txt

Jason 10 15 20 25 18 20 26 Samantha 15 18 29 16 26 20 23 Ravi 20 26 18 29 10 12 20 Sheila 17 20 15 26 18 25 12 Ankit 16 8 28 20 11 25 21

, the current input looked like this:

Please help me fix this following C++ code #include #include #include using

but i need the input to look like this:

namespace std; void readData(string names[], int scores[][7]){ ifstream infile("ch8_Ex12Data.txt"); int i,j; for(i=0;i

so in another word, i need the numbers to output 10.00, 15.00, 20.00 instead of 10 15 or 20 that i have currently, thank you for your help in advance if you can help me solve this and i will upvote.

NameJasonSamanthaRaviSheilaAnkitDay11015201716Day2151826208Day32029181528Day42516292620Day518261018112020122525 Name Day 1 Day 2 Day 3 Day 4 Day 5 Jason 10.00 15.00 20.00 25.00 18.00 20.0 Ravi 20.00 26.00 18.00 29.0010.0012.0 NameJasonSamanthaRaviSheilaAnkitDay11015201716Day2151826208Day32029181528Day42516292620Day518261018112020122525 Name Day 1 Day 2 Day 3 Day 4 Day 5 Jason 10.00 15.00 20.00 25.00 18.00 20.0 Ravi 20.00 26.00 18.00 29.0010.0012.0

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!