Using C, Create a set/list of enumerated constants called week that contains the
ID: 3868359 • Letter: U
Question
Using C, 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!" Using C, 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!"Explanation / Answer
#include<stdio.h>
enum week{Monday, Tuesdsy, Wednesday, Thursday, Friday, Saturday, Sunday};
void check(enum week data){
if (data == Saturday || data == Sunday){
printf("You can rest today! ");
}
else {
printf("Go to work! ");
}
}
int main()
{
enum week today;
today = Monday;
check(today);
today = Saturday;
check(today);
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.