Hello, im working on a two dimensional array assignment. I need to get "scores" from a text file named: scores.txt from four students and calculate the averages.
i get this:
Please enter the scores file name:
scores
Please enter the average file name:
average
Press any key to continue . . .
Student Ave Quizzes
1-858993460.0 -858993460-858993460-858993460-858993460
2-858993460.0 -858993460-858993460-858993460-858993460
3-858993460.0 -858993460-858993460-858993460-858993460
4-858993460.0 -858993460-858993460-858993460-858993460
Quiz averages = -858993460.0-858993460.0-858993460.0-858993460.0
Press any key to continue . . .
obviously im doing something completely wrong!!!
any assistance please
This is my code
//Reads quiz scores for each student into the two-dimensional array grade (but
//the input code is not shown in this display). Computes the average score
//for each student and the average score for each quiz. Displays the quiz scores
//and the averages.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <iostream>
#include <cstdlib>
const int NUMBER_STUDENTS = 4, NUMBER_QUIZZES = 4;
void compute_st_ave(const int grade[][NUMBER_QUIZZES], double st_ave[]);
//Precondition: Global constants NUMBER_STUDENTS and NUMBER_QUIZZES
//are the dimensions of the array grade. Each of the indexed variables
//grade[st_num − 1, quiz_num − 1] contains the score for student st_num on quiz
//quiz_num.
//Postcondition: Each st_ave[st_num − 1] contains the average for student
//number stu_num.
void compute_quiz_ave(const int grade[][NUMBER_QUIZZES], double quiz_ave[]);
//Precondition: Global constants NUMBER_STUDENTS and NUMBER_QUIZZES
//are the dimensions of the array grade. Each of the indexed variables
//grade[st_num − 1, quiz_num − 1] contains the score for student st_num on quiz
//quiz_num.
//Postcondition: Each quiz_ave[quiz_num − 1] contains the average for quiz number
//quiz_num.
void display(const int grade[][NUMBER_QUIZZES],
const double st_ave[], const double quiz_ave[]);
//Precondition: Global constants NUMBER_STUDENTS and NUMBER_QUIZZES are the
//dimensions of the array grade. Each of the indexed variables grade[st_num − 1,
//quiz_num − 1] contains the score for student st_num on quiz quiz_num. Each
//st_ave[st_num − 1] contains the average for student stu_num. Each
//quiz_ave[quiz_num − 1] contains the average for quiz number quiz_num.
//Postcondition: All the data in grade, st_ave, and quiz_ave has been output.
int main( )
{
using namespace std;
int grade[NUMBER_STUDENTS][NUMBER_QUIZZES];
double st_ave[NUMBER_STUDENTS];
double quiz_ave[NUMBER_QUIZZES];