Skip to content

C++ Program with Enumeration – enum

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

1 thought on “C++ Program with Enumeration – enum”

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!