I am extremely new to C++ and currently taking it for my Computer Engineering degree. I have an assignment i've been working on and was wondering if anyone could help me out. I know I am having problems with making my functions and passing my functions. The program is pretty simple. Please, any help would be great-fast!
Thanks
Code:
/************************************************************************
*
*
* Assignment: Week 6 Grade Arrays
*
* Write a program that asks the user how many students
* to process, then reads in the scores for two items, u
* an exam score and lab average, for that many students,
* then calculates and displays a table of the students’
* grade information.
*
* Filename: gradeArray.cpp
*
* Input: Numeric menu items from the keyboard
*
* Output: Table of entered scores and calculated grades
*
**************************************************************************/
#include<iostream>
#include<iomanip>
#define MAX_STUDENTS 20 //sets a default value that can be used for initializing the arrays
using namespace std;
int getStudentCount();
int getExamScores(int, double[]);
int getLabScores(int,double[]);
int calculatePointGrades(double[], double[], int, double[]);
int calculateLetterGrades(double[],char[], int);
int showGradeData(double[],double[],char[], double[],int);
double arrayExamAve(int, double[]);
double arrayLabAve(int, double[]);
void arrayPointGrades(char[], double[], int);
char arrayLetterGrades(double[]);
// Declare functions here, include the necessary parameters here and in the actual functions below.
// (once the function prototypes are created, the main()
// function can be moved back to the top of the code.)
// Declare the arrays here
void main() // controls program sequence (can be moved back to the top once the function parameters are defined.)
{
double numStudents = getStudentCount();
cout << "You entered: " << numStudents <<" Students!" <<endl;
//getStudentCount(numStudents);
getExamScores(numStudents,arrayExamAve);
//getLabScores(numStudents,arrayLabAve[lScores]);
//calculatePointGrades(arrayLabAve[lScores],arrayExamAve[eScores],getStudentCount,arrayPointGrades[grades]);
//calculateLetterGrades(arrayPointGrades[grades],arrayLetterGrades[grades],getStudentCount);
//showGradeData(arrayExamAve[eScores],arrayLabAve[lScores],arrayLetterGrades[grades],arrayPointGrades[grades],getStudentCount);
cout<<"processing has completed in main()"<<endl;// this statement is used for intial test and debugging
cin.ignore(2);
}
int getStudentCount()// Ask for and store the number of students from user
{
int numStudents= 0;
cout << "Please enter the number of students: ";
cin >> numStudents;
cout << endl;// this statement is used for intial test and debugging
return numStudents; // returns the user entered number of students to main
}
int getExamScores(int numStudents, double arrayExamAve)// Gets exam scores from user, loads the array
{
cout << "Please enter the exam grades for each student:";
for (int eScores = 0; eScores <= numStudents; eScores++)
{
cin >> arrayExamAve[eScores];
cout << endl;// this statement is used for intial test and debugging
return 0; // returns no values to main
}
}
int getLabScores(int numStudents,double arrayLabAve[])// Gets lab scores from user, loads the array
{
cout<<"Please enter the lab scores for each student:";
for (int lScores = 0; lScores <= numStudents; lScores++)
{
cin >> arrayLabAve[lScores];
cout << endl;// this statement is used for intial test and debugging
return 0; // returns no values to main
}
}
int calculatePointGrades(double arrayLabAve[], double arrayExamAve[], int getStudentCount,double arrayPointGrades[] )// Calculates the student's numeric grade, loads the point grade array
{
// int grade=0;
// int sum=0;
// int pointGrade=0;
// for (sum = 0; sum <= numStudents; sum++)
// { sum = arrayLabAve[] + arrayExamAve[];
// pointGrade = sum/2;
// cin >> arrayPointGrades[grade];
// cout << endl;
// }
//
//// this statement is used for intial test and debugging
//return; // returns no values to main
}
int calculateLetterGrades(double arrayPointGrades[],char arrayLetterGrades[], int getStudentCount)// Determines the student's letter grade, loads the array
{
char A,B,C,D,F;
int grade;
arrayPointGrades[grade];
if (grade >= 90)
cout << 'A';
else if (grade >= 80)
cout << 'B';
else if (grade >= 70)
cout << 'C';
else if (grade >= 60)
cout << 'D';
else
cout << 'F' << endl;
cin >> arrayLetterGrades[grade];
return 0;
// this statement is used for intial test and debugging
// returns no values to main
}
//void showGradeData(double arrayExamAve[],double arrayLabAve[],char arrayLetterGrades[], double arrayPointGrades[],int getStudentCount )// Prints a table of the student's scores and grades from the arrays
//{
// cout << arrayExamAve[eScores] << arrayLabAve[lScores] << arrayLetterGrades[grades] << arrayPointGrades[grades];
// cout <<endl;// this statement is used for intial test and debugging
// // returns no values to main
//}
double arrayExamAve(int numStudents,double arrayExamAve[]) // Averages the student's numeric exam grades from the array
{
int eScores=0;
int sum=0;
double ave=0;
for (sum = 0; sum <= numStudents; sum++)
{ sum = sum + arrayExamAve[eScores];
ave = sum/numStudents;
}
// this statement is used for intial test and debugging
return ave; // returns average exam score to main
}
double arrayLabAve(int numStudents,double arrayLabAve[])// Averages the student's numeric lab grades from the array
{
int lScores=0;
int sum=0;
double aveg=0;
for (sum = 0; sum <= numStudents; sum++)
{ sum = sum + arrayLabAve[lScores];
aveg = sum/numStudents;
}
// this statement is used for intial test and debugging
return aveg; // returns average lab score to main
}
void arrayLetterGrades(char [5], double arrayPointGrades[], int grades)
{
}
//double arrayPointGrades[double grades]
//{
//
// return arrayPointGrades[grades];
//
//}


