basically im working on making a menu in C
Ive made the menu, it shows everything but now i need to get the user to select a function from the menu, i.e. pushing 1 will lead you to a new function called kitchen, 2 will lead you to lounge, etc. there are 7 options so ive used 7 if statements, but for some reason they arent working, no matter what i push they all go to a function called kitchen(), when i use a non numeric character the program just crashes,
below is the code for my main function, can someone see any problems?
int main(void)
{
float menu;
printf("Renovation Calculation \n");
printf("1. Calculate Kitchen \n");
printf("2. Calculate Lounge \n");
printf("3. Calculate Bedroom \n");
printf("4. Calculate Dining Room \n");
printf("5. Calculate Bathroom \n");
printf("6. Calculate Total \n");
printf("7. Exit \n");
scanf("%d", &menu);
if (menu=1)
kitchen();
{
if (menu=2)
lounge();
{
if (menu=3)
bedroom();
{
if (menu=4)
dining();
{
if (menu=5)
bathroom();
{
if (menu=6)
total();
{
if (menu=7)
fo();
else
{
printf("Sorry, you have entered an invallid character. Please enter a number between 1 and 7. \n");
main();
}
}
}
}
}
}
}
}
id appreciate ne help,
cheers,
ben