Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7786525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:25:52+00:00 2026-06-01T20:25:52+00:00

Hey can anyone see what wrong with my menu in the while loop it

  • 0

Hey can anyone see what wrong with my menu in the while loop it keeps printing out dixie if i press 1 in an unlimited loop. I have a while loop around the menu so that the menu is always there for the user to go back through choices.
here is my code:

#include <iostream>
using namespace std;

int main()
{
    int choice;
    bool menu = true;
    cout <<"========Welcome to the database menu========\n";

    cout << "Press 1 to insert a new record at a particular position\n"
            "Press 2 to delete a record from a particular position\n"
            "Press 3 to search the database  and print results\n"
            "Press 5 to find the average experience points of players at a particular level\n"
            "Press 6 to find and remove all duplicate entries\n"
            "Press 0 to quit\n\n\n\n\n\n\n\n\n";

    cout << "Choice: ";
    cin >> choice;
    //*****************************************************************************
    // Switch menu to display the menu.
    //*****************************************************************************
    while(menu)
    {
        switch (choice)
        {
            case 1:
                cout << "dixie";
                break;
            case 2:
                cout << "bexie";
                break;
            default:
                cout<< "That is not a choice!!!\n";
        }
    }    
    getchar();
    getchar();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:25:53+00:00Added an answer on June 1, 2026 at 8:25 pm

    It says while (menu) and that means it’ll keep doing that until you set menu to false.

    Also, I think you want to add the cin >> choice in the loop, or it’ll just repeat the selection again and again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, can anyone explain me what (id)sender exactly means? I have seen it
Hey guys , Can anyone help me out to add images in folder and
Hey all how can i set this up for a loop? data.row9_1 I cant
Hey guys, this is simple but I can't make it workn... blah! I have
Hey, can anyone please tell me, what are difference between Dom parser and Xerces
Hey so I'm making a factoring program and I'm wondering if anyone can give
hey i'm new to iOS and having a hard time with RestKit can anyone
Hey, can anyone notice any errors in this code: <?php include(config.php); if(isSet($_POST['lastmsg'])) { $lastmsg
Hey, I'm having a strange issue. I'm wondering if anyone can help me make
Hey can anyone whip up a regex that i could use to validate strings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.