Hello! I'm pretty new to this and I'm having some trouble creating a gradebook.
after asking for student id's along with test numbers and test scores, the program is supposed to list everything out. I'm fairly certain the problem is in the arrays. any help will be greatly appreciated.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
const int MAX_STUDENTS = 50;
const int MAX_TESTS = 10;
double testave[MAX_TESTS];
int testscore[MAX_STUDENTS][MAX_TESTS];
int nstuds, ntests;
cout << "Welcome to Grade Book version 0.1\n" << "Copyright (C) Andy Pak 2009. All rights reserved.\n\n";
cout << "Enter maximum number of students and tests: ";
cin >> nstuds >> ntests;
int i = 0;
int j = 0;
int sid[MAX_STUDENTS] = {0};
int tid[MAX_TESTS] = {0};
if ((nstuds <= MAX_STUDENTS) && (ntests <= MAX_TESTS))
{
It would help if the code was properly indented. You don't actually say what's going wrong, you can't expect anyone to compile for you.
I can't understand why you're addng one to everything. What happens if there are 50 students and I am enterng the data for student #50? sid[51]?
The input routine seems very impractical. The user has to type the studentId in for every testScore, doubling the amount of typing necessary. I would recommend allowing the user to type all the data in order.
Example:
Enter 5 test scores for student #1 : 85 86 93 92 95
Enter 5 test scores for student #2 : 90 88 94 96 95
etc.
dont know what you have going on in the that mess, i too dont understand the +1,
reformat it, restate your question, and use code tags, it will make it easier on us