For some odd reason, I can't get anything to be displayed when the program is running. I believe its not passing anything at all which would explain the blank console. If anyone could help me out that would be great.
Without using functions the program successfully shows:
1) Student's name
2) Current Grade
3) Overall grade
4) Inputs are successfully entered
5) Outputs are correctly displayed
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
//Prototypes being used:
void userData(string, int, char);
double calData(int, int, int);
void displayData(string, char, double);
//Variables
string studentName;
char letterGrade;
int numOfClasses, qp, totalPoints;
double gpa;
int main()
{
//called functions
void userData(string studentName, int numOfClasses, char letterGrade);
double calData(int totalPoints, int numOfClasses);
void displayData(string studentName,char letterGrade, double gpa);
getch();
return 0;
}
void userData(string studentName, int numOfClasses, char letterGrade)
{
do
{
cout << "Enter the student's name: ";
cin >> studentName;
cout << "Enter number of classes taken: ";
cin >> numOfClasses;
if (numOfClasses > 3)
cout << "ERROR: Only 3 Classes per term!" << endl;
}while (numOfClasses>3);
for (int i=1; i <numOfClasses; i++)
{
cout << "Enter the letter grade for class #" << i << ": ";
cin >> letterGrade;
if (letterGrade == 'A')
qp = 4;
else if (letterGrade == 'B')
qp = 3;
else if (letterGrade == 'C')
qp = 2;
else if (letterGrade == 'D')
qp = 1;
else
qp = 0;
totalPoints += qp;
}
}
double calData(int totalPoints, int numOfClasses)
{
gpa = totalPoints/numOfClasses;
return gpa;
}
void displayData(string studentName, char letterGrade, double gpa)
{
cout << endl << " STUDENT NAME: " << studentName;
cout << endl << " OVERALL GRADE: " << letterGrade;
cout << endl << " CURRENT GPA: " << gpa << endl;
}