Oct 26, 2015 at 6:57pm UTC
Can't seem to figure out what is causing this error, any help would be greatly appreciated.
error C2660: 'getScoresAndCalculateTotal' : function does not take 1 arguments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
string getStudentName();
int getNumberExams();
int getScoresAndCalculateTotal();
double calculateAverage(int , int );
char determineLetterGrade(double );
void displayAverageGrade(string, double , char );
int main(void )
{
//Declare variables
string name;
string dummy;
int exams = 0;
int score = 0;
int total = 0;
double average = 0;
char letter;
getStudentName();
exams = getNumberExams();
total = getScoresAndCalculateTotal(exams);
average = calculateAverage(total, exams);
letter = determineLetterGrade(average);
displayAverageGrade(name, average, letter);
return 0;
}
string getStudentName()
{
string dummy;
string name;
getline(cin, dummy);
cout << "\nPlease enter the student's name: \n" ;
getline(cin, name);
return name;
}
int getNumberExams()
{
int exams;
cout << "Please enter the number of exams taken by the student in the course: \n" ;
cin >> exams;
return exams;
}
int getScoresAndCalculateTotal(int exams)
{
int score = 0;
int total = 0;
cout << "Enter the exam scores:" ;
for (int i = 1; i <= exams; i++)
{
cout << "\nExam " << i << ": " ;
cin >> score;
total = total + score;
}
return total;
}
double calculateAverage(int total, int exams)
{
double average = 0;
average = total / exams;
return average;
}
char determineLetterGrade(double average)
{
char letter;
if (average >= 90)
letter = 'A' ;
else if (average >= 80)
letter = 'B' ;
else if (average >= 70)
letter = 'C' ;
else if (average >= 60)
letter = 'D' ;
else
letter = 'F' ;
return letter;
}
void displayAverageGrade(string name, double average, char letter)
{
cout << endl << endl;
cout << "Student Name: " << name << endl;
cout << "Average: " << average << endl;
cout << "Letter Grade Earned: " << letter;
cout << endl << endl;
}
Last edited on Oct 26, 2015 at 7:13pm UTC
Oct 26, 2015 at 7:15pm UTC
Thanks, I think I got the issue.
Last edited on Oct 26, 2015 at 7:19pm UTC