I'm trying to creat a function that will take the score input
and give the output in a letter grade form of the total that got the score within that range.
This is what I have but it doesn't work.
Can I get help?
/display scores total by grade
scoreByGrade
cout << "Number of students earning a score of " << enteredScoreA_count << ": "
<< enteredScoreA << endl;
cout << "Number of students earning a score of " << enteredScoreB_count << ": "
<< enteredScoreB << endl;
cout << "Number of students earning a score of " << enteredScoreC_count << ": "
<< enteredScoreC << endl;
cout << "Number of students earning a score of " << enteredScoreD_count << ": "
<< enteredScoreD << endl;
cout << "Number of students earning a score of " << enteredScoreF_count << ": "
<< enteredScoreF << endl;
//*********function definitions**********
// Count of letter grades entered
void scoreByGrade (int enteredScoreA_count=0, enteredScoreB_count=0, enteredScoreC_count=0,
enteredScoreADcount=0,enteredScoreF_count=0)
while(grade != SENTINEL) // Add to grade counts until SENTINEL is entered.
{
switch(scores)
{
case'A':
enteredScoreA++; // Add 1 to count of A grades
break;
case'B':
enteredScoreB++; // Add 1 to count of B grades
break;
case'C':
enteredScoreC_count++; // Add 1 to count of C grades
break;
case'D':
enteredScoreD_count++; // Add 1 to count of D grades
break;
case'F':
enteredScoreD_count++; // Add 1 to count of F grades
break;
}
}
// end switch
// Just something for no reason.
#include <iostream>
#include <cctype>
// It seems to me that you want to make a program that tallies
// the amount of A's B's and etc you enter and then report it.
usingnamespace std;
struct gradetally { // Keeps the tally of the inputted grades.
int a,b,c,d,f;
}basic; // Just go ahead and make this object.
int main() {
string myEntry;
// I made the do while {} block like this so it'll be fast, be able to accept both
// upper and lower case, and also have no problem taking other mistaken input without error.
// It just discards it, also it confirms a successful grade input.
do {
cout << "Input grade : ";
cin >> myEntry;
if(myEntry=="A"|| myEntry == "a") {
basic.a++; cout << "Confirmed" << endl;
} elseif(myEntry=="B"|| myEntry=="b") {
basic.b++; cout << "Confirmed" << endl;
} elseif(myEntry=="C"|| myEntry=="c") {
basic.c++; cout <<"Confirmed" <<endl;
} elseif(myEntry=="D"|| myEntry=="d") {
basic.d++; cout <<"Confirmed" << endl;
} elseif(myEntry=="F"|| myEntry=="f") {
basic.f++; cout << "Confirmed" << endl;
}
} while( myEntry != "SENTINEL" ); // Input SENTINEL and it dies and reports the results.
// Show results of your inputting.
cout << "Amount of A's : " << basic.a << endl;
cout << "Amount of B's : " << basic.b << endl;
cout << "Amount of C's : " << basic.c << endl;
cout << "Amount of D's : " << basic.d << endl;
cout << "Amount of F's : " << basic.f << endl;
}