DEV Community

jarry
jarry

Posted on

C++ Mobile Menu

I am working on mobile menu in C++ but i am getting error in following code please guide

include

include

using namespace std;

void displayMenu() {
cout << "Mobile Menu:" << endl;
cout << "1. Call" << endl;
cout << "2. Messages" << endl;
cout << "3. Contacts" << endl;
cout << "4. Exit" << endl;
cout << "Enter your choice: ";
}

int main() {
int choice;

do {
    system("clear");  // Use "cls" for Windows
    displayMenu();
    cin >> choice;

    switch (choice) {
        case 1:
            cout << "Calling..." << endl;
            break;
        case 2:
            cout << "Checking Messages..." << endl;
            break;
        case 3:
            cout << "Viewing Contacts..." << endl;
            break;
        case 4:
            cout << "Exiting..." << endl;
            break;
        default:
            cout << "Invalid choice. Please try again." << endl;
    }

    cout << "Press Enter to continue...";
    cin. ignore();  // Clear the newline character from the input buffer
    cin.get();     // Wait for Enter key press

} while (choice != 4);

return 0;
Enter fullscreen mode Exit fullscreen mode

}

I want to copy menu of MbWhatsapp ios MbWhatsapp ios

Top comments (0)