I was attempting to initilize bool done to false, then have this program continue to give the user the option to do more check balance functions util they pressed exit, however, my program continues to cycle repeatedly, even after option 5 (EXIT) is entered. Please, some help on how to recode so that program breaks out after this selection. Thanks. Will

change do while into while... and initialize done = true instead of false. then when you press 5 (exit) change done = false to exit the loop...

int main ()
{

  double checking, savings;
  int choice;

  get_balances (checking, savings);

  bool done = true;

  while(done)  {
       display_menu ();
       cout << "Enter Choice: ";
       cin >> choice;
       
       switch (choice)
       {
            case TRANSFER:
            transfer (checking, savings);
            break;

            case WITHDRAW:
            withdraw (checking);
            break;

            case CHECK:
            withdraw (checking);
            break;

            case DEPOSIT:
            deposit (checking);
            break;

            case EXIT:
            done = false;
            break;
	     }

  display_balances (checking, savings);
  }
  
  return 0;

}

or if you still want your orignal do while loop, change the condition inside the while... like this one:

do  {

// statement

} while(done==false);

Thanks so much. It is awsome of people to give there time to coach learners on here. Waiting for replies from teachers can take days, as can staring at what tends to be simple problems hoping for a solution to jump onto the screen. I appriciate the help.--Will

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.