Sunday, December 6, 2009
CHARacter in switch case
,
Author: Raviteja
|
Filed Under:
c++
|
#include "iostream.h"
#include "conio.h"
class yr
{
private:
char c;
public:
void accept ()
{
cout << "Enter a Character for gender: ";
cin >> c;
}
void cal ();
};
void yr :: cal ()
{
switch (c)
{
case 'm':
case 'M':
cout << "Male";
break;
case 'f':
case 'F':
cout << "Female";
break;
default:
cout << "Invalid Gender Character\n";
}
}
void main ()
{
clrscr ();
yr Y;
Y.accept ();
Y.cal ();
getch ();
}
Get the executable ( .exe ) file for this program..
Download
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment