Sorry about that guys The warning and errors I am getting are
Code:
case label dose not reduce to an integer constant
Code:
case label dose not reduce to an integer constant
Code:
warning: comparison between pointer and interger
Code:
warning: unreachable code at beginning of switch statement
Code:
#include <stdio.h>
#define SONG "Say It Aint So"
#define SHOW "Survivorman"
int menu (void);
void song (void);
void show (void);
int QUIT(void);
int main(void)
{
char choice;
choice = menu(); /* get user's first selection */
while(choice != QUIT)
{
switch(choice)
{
case SHOW: show();
break;
case SONG: song();
break;
default: printf("Oops! An invalid choice slipped through. ");
printf("Please try again.\n");
}
choice = menu(); /* get user's subsequent selections */
}
printf("Bye bye!\n");
/* These next 3 lines are helpful if your program doesn't pause to let you
see the output. (Not required.)
*/
printf("Press Enter to end the program.\n");
fflush(stdin);
getchar();
return 0;
}
int menu(void)
{
int option;
printf("Learn about me! Please select from the menu\n\n");
printf("1. Learn the name of my favourite show\n");
printf("2. Learn the first line of my favorite song\n\n");
printf("0. Quit this program\n\n");
printf("Enter your choice: ");
while( (scanf(" %d", &option) != 1) /* non-numeric input */
|| (option < 0) /* number too small */
|| (option > 2)) /* number too large */
{
}
return option;
}
void song(void)
{
printf(" %s\n", SONG);
}
void show(void)
{
printf(" %s\n", SHOW);
}