You are on page 1of 2

Declare the function for the menu:

void menu() {
printf("Welcome to the Motorbikes Shop\n");
printf("Who are you?\n");
printf("1. Shop owner\n");
printf("2. Customers\n");
printf("3. Exit\n");
printf("_____\n");
printf("Enter the number: ");
}
In your main function, call the menu() function to display the menu:

#include <stdio.h>

void menu() {
// The menu code
}

int main() {
menu();

return 0;
}
Implement the functionalities for the shop owner, customers, and exit:

#include <stdio.h>
#include <stdlib.h>

void menu() {
// The menu code
}

void shop_owner() {
// The functionalities for the shop owner
}

void customers() {
// The functionalities for the customers
}

int main() {
int choice;

do {
menu();
scanf("%d", &choice);

switch (choice) {
case 1:
shop_owner();
break;
case 2:
customers();
break;
case 3:
printf("Exiting the program...\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
} while (choice != 3);

return 0;
}
This way, the program will display the menu, ask the user to enter a number, and perform the
corresponding action. If the user enters 3, the program will exit.

You might also like