#include <iostream.h>
#include <ctype.h>
/***************************************************************
Program: if_else_if.C
An example of "if - else - if" statements
This program converts lower case to upper case
***************************************************************/
int main()
{
char my_char;
cout << "Enter a lower case letter:";
cin >> my_char;
if (my_char < 'a') // test condition
cout << "Sorry, you must enter a lower case letter. \n";
else if (my_char > 'z') // nested if
cout << "Sorry, you must enter a lower case letter. \n";
else
{
char upper_char=toupper(my_char);
cout << "In upper case " << my_char << " is:" << upper_char <<
endl;
}
return(0);
}
Back to Previous Page
Document:
Local Date:
Last Modified On: