OK Here is the problem that I am trying to do:
Create a set/list of enumerated constants called week that contains the days of the week. Have a variable called today that is of type week. Assign a value to today. If the day is Monday through Friday, print "Go to work!" If the day is Saturday or Sunday, print "You can rest today!"
I thought that I did it correctly, but I cant get it to work right. It says "Go to work" for everyday. Any suggestions? Here is my code:
Code:#include <stdio.h> enum week{ Monday=0,Tuesday=1,Wednesday=2,Thursday=3,Friday=4,Saturday=5,Sunday=5 }; int main() { enum week today; int day; printf("Enter the day of the week(Sunday-Saturday): "); scanf("%s", &day); switch (day) { case 0: day = Monday; break; case 1: day = Tuesday; break; case 2: day = Wednesday; break; case 3: day = Thursday; break; case 4: day = Friday; break; case 5: day = Saturday; break; case 6: day = Sunday; break; } if (day >5) { printf("\nGo to work!"); } else { printf("\nYou can rest today!"); } return 0; }