Unable to exit program

Discussion in 'C++' started by Kenneth Reid, Jan 1, 2022.

Tags:
  1. Kenneth Reid

    Kenneth Reid New Member

    Joined:
    Dec 22, 2021
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Occupation:
    Disabled
    I am working on a large C++ (console) project that has multiple menus (1 main menus with 4 options, and each of those options as additional options or menus).

    The int main() module simply calls the "MainMenu()" option, which has 5 options to choose from - 4 options to go to other menus, and 1 option to "Exit the progam". If I choose to exit the program before going to any other menu, the program will exit, but as soon as another menu option is chosen, the program will not exit.

    I have no idea what is causing this to happen. I have tried changing the return 0 in the int main() module to exit to see if that fixed the problem, but it did not work, so I switched it back to return 0.

    When I choose any of the other menu options (which also have an option to exit the program), and I choose the exit program option, the program refuses to exit. All it does is continue to ask for user input (when I choose the "exit program" option). If I go back to the main menu, it does the same thing - it refuses to exit the program.

    I have looked for a solution online for the past several days, but have not found anything that works.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Can you share the code?

    You can also use exit function as well. Have you considered it?
     
  3. Kenneth Reid

    Kenneth Reid New Member

    Joined:
    Dec 22, 2021
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Occupation:
    Disabled
    I have tried using exit, and it still does not close the program.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice