#include <iostream>
#include <cstdio>
usingnamespace std;
void grade_converter(char);
char grade_converter(int,char);
int main(){
char testOne, NewTestTwo;
int testTwo;
bool valid;
do{
valid=true;
cout<<"Please enter the first test's letter grade: ";
cin>>testOne;
switch(testOne){
case'A':
case'B':
case'C':
case'D':
case'F':
break;
default:
cout<<"\nInvalid grade!\n";
valid=false;
}
}while(!valid);
do{
valid=true;
cout<<"\nPlease enter the second test's score: ";
cin>>testTwo;
if (testTwo>100||testTwo<0){
cout<<"\nInvalid Input!";
valid=false;
}
}while(!valid);;
grade_converter(testOne);
grade_converter(testTwo,NewTestTwo);
cout<<"\nThe letter grade on your second test is "<<NewTestTwo;
system("pause");
}
void grade_converter(char testOne){
switch (testOne){
case'A':
cout<<"\nScore range for your first test is 90-100";
break;
case'B':
cout<<"\nScore range for your first test is 80-89";
break;
case'C':
cout<<"\nScore range for your first test is 70-79";
break;
case'D':
cout<<"\nScore range for your first test is 60-69";
break;
case'F':
cout<<"\nScore range for your first test is 0-59";
break;
default:;
}
}
char grade_converter(int testTwo,char NewTestTwo){
if (testTwo>89){
NewTestTwo='A';
}if (testTwo>79&&testTwo<90){
NewTestTwo='B';
}if (testTwo>69&&testTwo<80){
NewTestTwo='C';
}if (testTwo>59&&testTwo<70){
NewTestTwo='D';
}if (testTwo<60){
NewTestTwo='F';
}
return(NewTestTwo);
}
For some reason the letter grade ("NewTestTwo") wont display, am I not returning it correctly to the main function?