hey guys heres a program thats suppose to assign a letter grade to a given percentage on an exam and i just keep gettin the same three erros at the bottom saying i have undeclatred indentifiers but i dont see how so any help would be very much appreciated

#include <iostream>
#include <string>
using namespace std;
void GetScore (double&);
bool IsValid (double&);
string LetterGrade (double&);
void Display(double&, string&, bool&);
 
int main()
{
double exam_score;
bool check;
string letter_grade;
GetScore(exam_score);
check = IsValid(exam_score);
letter_grade = LetterGrade(exam_score);
Display(exam_score, letter_grade, check);
cout<<"Written By Ravi Mandair CPSC 1103 Section 10"<<endl;
return 0;
}
void GetScore(double& get_data)
{
cout<<"Please enter your exam score as a percentage\n"
<<"but without the actual % sign: ";
cin>>get_data;
return;
}
bool IsValid (double& data)
{
bool check_data;
if ((data >= 0) && (data <= 100))
check_data = true;
else
check_data = false;
 
return check_data;
}
 
string LetterGrade(double& exam_percentage)
{
string assign_grade;
if (exam_percentage >= 80 && exam_percentage <= 100)
assign_grade = 'A';
if (exam_percentage >= 60 && exam_percentage <= 79)
assign_grade = 'B';
if (exam_percentage >= 50 && exam_percentage <= 59)
assign_grade = 'A';
if (exam_percentage >= 49)
assign_grade = 'F';
 
return assign_grade;
}
void Display(double& exam_score, letter_grade, string&, bool&, check)
{
if (check = true)
cout<<"You recieved a score of "<<exam_score<<" which\n"
<<"is equivalent to the letter grade "<<letter_grade<<endl;
else 
cout<<"You entered a score of "<<exam_score<<endl
<<" ,invalid mark is out of range";
 
return;
}

Recommended Answers

All 2 Replies

The number of parameters in the Display() function definition doesn't match the number of parameters in the Display() function declaration. Too many commas there. Redo the definition and recompile.

N.B. next time try putting a / before the word code at the end of your code when using code tags. Thanks for trying!

hehe ty :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.