Question
Using C++ with 2D array and function to write this program. Below is requirements So far, this is my code. Please help me with that.
Using C++ with 2D array and function to write this program. Below is requirements
So far, this is my code. Please help me with that.
#include
#include
#include
#include
#include "Header.h"
using namespace std;
const int COLS = 5;
const int ROWS = 15;
int scores_tt[ROWS][COLS];
double averages_tt[15] = {};
int main()
{
header_info();
ifstream inFile;
ofstream outFile;
inFile.open("data_tt.txt");
//int cols, rows;
char students_tt[15][10] = {
"Bill", "Tim", "Betty", "Jaden", "Mary", "Ashley",
"Danny", "Ryan", "Nicole", "Tanya", "Emily", "Robert",
"Dale", "John", "Kevin"
};
void showArray(int[][COLS], int);
if (inFile.is_open())
{
int counter = 0;
while (inFile.eof() == false)
{
inFile >> scores_tt[counter][0];
inFile >> scores_tt[counter][1];
inFile >> scores_tt[counter][2];
inFile >> scores_tt[counter][3];
inFile >> scores_tt[counter][4];
//getline(inFile, names[counter]);
counter++;
}
}
else
cout
for (int count = 0; count
cout
}
for (int counter = 0; counter
{
for (int index = 0; index
{
cout
cout
}
return 0;
inFile.close();
}
}
int calc_tt() {
double classAverage = 0;
for (int counter = 0; counter
{
classAverage += (scores_tt[counter][0] + scores_tt[counter][1] + scores_tt[counter][2] + scores_tt[counter][3] + scores_tt[counter][4]);
}
cout
return classAverage;
}
void prt_jd() {
}
Input File(data_tt.txt)
90 89 89 99 100 22 38 29 78 77 83 98 44 94 98 98 98 78 87 67 87 88 67 98 78 98 78 67 87 99 100 100 100 83 88 83 92 83 98 29 83 84 98 90 48 98 83 78 87 98 88 84 78 98 49 49 89 90 89 78 48 84 90 89 98 87 77 99 77 55 78 85 98 83 37
Student ID ending with an Odd Number Write a program that will find the average of five (5) test scores for fifteen (15) different students. The average scores must be stored into an integer array Student ID ending with an Even Number Write a program that will find the class average of fifteen (15) test scores for five (5) different tests. The class average must be stored into an integer array You are to have three separate arrays Note: _jd represents the initials of the programmer. Your array and function names should be named by replace the initials jd with your first and last initials Arra Name of arra Size of arra Data for arra Student Names students id 151110 Initialized in code Scores scores id [15115] Read from data file Averages averages_jd [15] or [5] Calculated and stored Excluding the main function, your program should have three additional functions that will get the scores, calculate the averages and display your output. Functions Calculate Average Called from main and add data to array d add averages to array scores and average array Read Input File et id Called from main Output Results Name of function Properties of function Definition of Function Should pass scores array Should pass average array Should pass students, calc Called from main and print data Data file should be named data_jd.txtStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started