This isn't compiling properly. Where do I declare month_t and cur_month #include #include int main() { enum month_t {HAPPYNEWYEAR=1, /*enumeration*/ SUMMER=6,BACKTOSCHOOL=9,HAPPYHOLIDAYS=12}; month_t cur_month=BACKTOSCHOOL; switch(cur_month) { case HAPPYNEWYEAR: printf("Happy New Year\n"); break; case SUMMER: printf("Summer begins\n"); break; case BACKTOSCHOOL: printf("Back to school\n"); break; case HAPPYHOLIDAYS: printf(" Happy Holidays\n"); break; } getch(); return 0; }
This isn't compiling properly. Where do I declare month_t and cur_month
#include <stdio.h>
#include<conio.h>
int main()
{
enum month_t {HAPPYNEWYEAR=1, /*enumeration*/
SUMMER=6,BACKTOSCHOOL=9,HAPPYHOLIDAYS=12};
month_t cur_month=BACKTOSCHOOL;
switch(cur_month)
{
case HAPPYNEWYEAR:
printf("Happy New Year\n");
break;
case SUMMER:
printf("Summer begins\n");
break;
case BACKTOSCHOOL:
printf("Back to school\n");
break;
case HAPPYHOLIDAYS:
printf(" Happy Holidays\n");
break;
}
getch();
return 0;
}
#include <stdio.h>
#include<conio.h>
int main()
{
enum month_t {HAPPYNEWYEAR=1, /*enumeration*/
SUMMER=6,BACKTOSCHOOL=9,HAPPYHOLIDAYS=12};
enum month_t cur_month=BACKTOSCHOOL;
switch(cur_month)
{
case HAPPYNEWYEAR:
printf("Happy New Year\n");
break;
case SUMMER:
printf("Summer begins\n");
break;
case BACKTOSCHOOL:
printf("Back to school\n");
break;
case HAPPYHOLIDAYS:
printf(" Happy Holidays\n");
break;
}
getch();
return 0;
}
Step by step
Solved in 3 steps with 1 images