101
{ USER }
posts: 55
last: 09-Apr-2008
TITLE: Enum example
DESCRIPTION: An enum example in C++
Submitted: 09-Apr-2008 07:56:48 ( 38w 5d 21h ago ) Language: C++ (*.cpp *.h)
Views: 81 Lines of Code: 27 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 0.00 / 5 }
Difficulty: Intermediate
Bookmark
/* Author: 101
   Date: 09-04-2008
   Filename: 
   Description: An enum example in C++
   History: 
*/



#include <iostream.h> 
int main()
{
enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};

Days TheDay;
int j;
cout<<"Please enter the day of the week (0 to 6)";
cin>>j;
TheDay = Days(j);

if(TheDay == Sunday || TheDay == Saturday)
cout<<"Hurray it is the weekend"<<endl;
else
cout<<"Curses still at work"<<endl;

return 0;
}