"const char" recognition as lower or upper case

I'm writing a program that counts the number of times a grade is entered, using a while loop. I have the sentinel value as Z, but I'm not sure how to make it recognize both z and Z as the sentinel value, rather than just the latter. I'm assuming it involves using toupper somewhere, I'm just not sure where to put it.

// Michael Sproul SMSV010388
// A program that counts letter grades (A, B, C, D or F), using a SENTINEL value z.

#include<iostream>
using namespace std;

const char SENTINEL = 'Z';

void explain_program();
// Tells the user what the program does


int main()
{
char grade; // Grade entered by the user

int a_count=0, b_count=0, c_count=0,
d_count=0, f_count=0; // Count of letter grades entered.

explain_program(); // Tells the user what the program does

cout << "Please enter a letter grade or Z: ";
cin >> grade;

while(grade != SENTINEL) // Add to grade counts until SENTINEL is entered.
{
switch(toupper(grade))
{
case 'A':
a_count++; // Add 1 to count of A grades
break;

case 'B':
b_count++; // Add 1 to count of B grades
break;

case 'C':
c_count++; // Add 1 to count of C grades
break;

case 'D':
d_count++; // Add 1 to count of D grades
break;

case 'F':
f_count++; // Add 1 to count of F grades
break;

default:
cout << "Sorry, " << grade << " is not a valid grade.\n"; // Inform of an invalid grade
break;

}

cout << "Please enter a letter grade or Z: ";
cin >> grade;
}

cout << "There were " << a_count << " A's.\n";
cout << "There were " << b_count << " B's\n";
cout << "There were " << c_count << " C's\n";
cout << "There were " << d_count << " D's\n";
cout << "There were " << f_count << " F's\n";

return 0;

}

void explain_program()
{
cout << "This program counts letter grades of A, B, C, D, and F.\nEnter Z to end data input.\n\n";
}


Thanks!
while( toupper( grade ) != SENTINEL )
Strange, I thought I tried that, obviously not though. Thanks.
Topic archived. No new replies allowed.