Sunday 25 August 2013


C++ Program with Enumeration - enum

Code:
/*C++ Program with Enumeration - enum*/
#include<iostream.h>
#include<conio.h>
enum shape
{
circle,
rectangle,
triangle,
};
int main()
{
clrscr();
cout<<"\n Enter Shape Code:\n ";
int code;
cin>>code;
while(code>=circle && code<=triangle)
{
switch (code)
{
case circle:
cout<<" Its a circle";
break;
case rectangle:
cout<<" Its a rectangle";
break;
case triangle:
cout<<" its a triangle";
break;
}
cout<<"\n Enter Shape Code:\n ";
cin>>code;
}
return 0;
}

Sample Output:


Comment bellow for your Query and Feedback

Related Posts :



1 comment: