//R. A. Hillyard
//charFunctions.cpp
//program to demonstrate use built in character functions
#include<iostream> //new style of include
#include<cctype>
using namespace std;
int main()
{
char choice; //hold character entered by user
do
{
cout << "\n*** Welcome to the character guessing program ***\n\n";
cout << "Enter a character : ";
cin >> choice;
if(isdigit(choice)) cout << choice << " is a digit\n";
if(ispunct(choice)) cout << choice << " is a punctuation\n";
if(iscntrl(choice)) cout << choice << " is a control character\n";
if(isalpha(choice)) cout << choice << " is alpha\n ";
if(isupper(choice)) cout << choice << " is a upper case letter\n";
if(islower(choice)) cout << choice << " is a lower case letter\n";
cout << "\nTry again?? [Y/N]: ";
cin >> choice;
choice = toupper(choice);
}while(choice != 'N');
}//end main
/*******************Program Output*********************************
*** Welcome to the character guessing program ***
Enter a character : R
R is a upper case letter
Try again?? [Y/N]: Y
*** Welcome to the character guessing program ***
Enter a character : t
t is a lower case letter
Try again?? [Y/N]: Y
*** Welcome to the character guessing program ***
Enter a character : !
! is a punctuation
Try again?? [Y/N]: n
*/