The code below is a C++ code for the istructions that follow this note. I have a issue with lines 53 and 54: static[runCount][0] = total; static[runCount][1] = avg; The = signs have the red error...


The code below is a C++ code for the istructions that follow this note. I have a issue with lines 53 and 54:


static[runCount][0] = total;
static[runCount][1] = avg;


The = signs have the red error lines under them and I don't know why. If possible could you please find and correct what I did wrong and make sure it runs please. Thank you.


Jason, Samantha, Ravi, Sheila, and Ankit are preparing for an upcoming marathon. Each day of the week, they run a certain number of miles and write them into a notebook. At the end of the week, they would like to know the number of miles run each day, the total miles for the week, and the average miles run each day. Write a program to help them analyze their data. Your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. Furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results (You may assume that the input data is stored in a file and each line of data is in the following form:


runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)



#include
#include
#include
#include
using namespace std;


const int COUNT = 5;
const int DAYS = 7;


void inputData(string names[], int sizeOfName,
double numOfMiles[][DAYS], int rowSize)


{


ifstream infile;
infile.open("Data.txt");
int checkNames = 0, checkMiles = 0;


while (checkNames <>
{
infile >> names[checkNames];
while (checkMiles <>
{


infile >> numOfMiles[checkNames][checkMiles];
checkMiles++;
}
checkMiles = 0;
checkNames++;
}


}


void computeMiles(double status[][2], double numOfMiles
[][DAYS], int rowSize)
{


double total = 0, avg = 0;
int runCount = 0, num = 0;


cout < fixed="">< showpoint="">< setprecision(2)=""><>
while (runCount <>
{
while (num <>
{
total = total + numOfMiles[runCount][num];
num++;
}


avg = (total/DAYS);
static[runCount][0]
=
total;//error =

static[runCount][1]
=
avg;
// error =

total = 0;
avg = 0;
num = 0;
runCount++;
}
}


void displayResult(double status[][2], string names[],
int sizeOfName)


{
cout < setw(10)="">< "runner_name"=""><>
< "total="" miles"="">< setw(10)="">< "average"=""><>
int runCount = 0;
while (runCount <>
{
cout < setw(10)="">< names[runcount]=""><>
< status[runcount][0]="">< setw(10)=""><>
[1] <>
runCount++;
}
}
int main()
{
string names[COUNT];
double milesStatus[COUNT][DAYS];
double output[COUNT][2];


inputData(names, 5, milesStatus, 5);
computeMiles(output, milesStatus, 5);
displayResult(output, names, 5);


system("PAUSE");
return 0;


}

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here