so im trying to practice writing a few programs that might have to do with my upcoming test soon. in this program i wanted the user to enter a test score and it couts the letter grade. doesnt work properly it couts the test score instead of the letter grade. help?
#include <iostream>
using namespace std;
void inputScore(int* s);
bool isValidScore(int);
void processScore(int* c);
int main()
{
int average;
inputScore(&average);
cout <<"Your Grade is:" << average << endl;
system("pause");
return 0;
}
void inputScore(int* s)
{
bool result;
do {
cout <<"Enter Average :";
cin >> *s;
result = isValidScore(*s);
} while(result == false);
}
bool isValidScore (int x)
{
if (x >= 0 && x <= 100)
return true;
else
{
cout <<"Invalid Score" << endl;
return false;
}
}
void processScore(int* c)
{
if (*c >= 90 && *c <= 100)
{
cout <<"A" << endl;
}
else if (*c >=80 && *c <= 89)
{
cout <<"B" << endl;
}
else if (*c >=79 && *c <=70)
{
cout <<"C" << endl;
}
else if (*c >= 69 && *c <=60)
{
cout << "D" << endl;
}
else if (*c >= 59 && *c <=0)
{
cout << "F" << endl;
}
}