hi guys,im trying to create a menu which allow user to select their choice. When a choice is selected, a function designed for that choice will be called. However,it seems that i cant use 'if else' to call them, is there anyway to solve it?im sure i did it wrongly...if you cant understand what im talking about, here is the thing im doing : https://docs.google.com/document/d/1TsQJf0vlmkBNkwvt6rsKCAVshKyTNkm10YEbmIVeNyg/edit
thanks for taking time ! ^^
#include <stdio.h>
//Function Declarations
void quiz (void);
void calculator (void);
void optional (void);
int main (void)
{
//Local Declarations
int menu;
//Statements
printf("\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
printf("\t\t@ WELCOME TO CHEMY'S CHEMISTRY @\n");
printf("\t\t@ @\n");
printf("\t\t@ MAIN MENU @\n");
printf("\t\t@ @\n");
printf("\t\t@ 1. CHEMISTRY QUIZ @\n");
printf("\t\t@ 2. IDEAL GAS LAW CALCULATOR @\n");
printf("\t\t@ 3. OPTIONAL GAME @\n");
printf("\t\t@ @\n");
printf("\t\t@ 0. EXIT @\n");
printf("\t\t@ @\n");
printf("\t\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n");
printf("Please choose your menu: ");
scanf("%d", &menu);
if (menu == 1)
quiz ();
else if (menu == 2)
calculator ();
else if (menu == 3)
optional ();
else
printf("I'm sorry, but you have enter an invalid selection. Please try again.");
return 0;
}