Monday, May 5, 2008

program to check alphabet or digit, uppercase or lowercase

Write a program that will ask the user to enter a character. Check if it is alphabetic or not. If alphabetic, check whether it is in uppercase or lowercase.

PROGRAM:

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

#include <ctype.h>


void main() {

clrscr();

char ch;

cout<<"Enter a characher: ";

ch=getchar();

if(isalpha(ch)) {

cout<<ch<<" is an alphabet\n";

if(islower(ch))

cout<<ch<<" is in lowercase\n";

else

cout<<ch<<" is in uppercase\n";

}else

cout<<ch<<" is not an alphabet\n";

getch();

}//end of the program

1 comment:

Unknown said...
This comment has been removed by the author.