Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

but i need the input to look like this:

image text in transcribed

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

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions