Its a do-while loop. First It prints out
cout << "[1] Start\n[2] Return\n";
Then it takes input
cin >> a;
.
Now. It enters the switch statement. Say case 1 happens. Now all the stuff inside of case 1 happens, and then it comes back to the switch statement and goes down to the end
1 2 3
|
}
} while (a != 2);
}
|
Then it sees the while statement, saying, run this as long as while is not 2. And then it remembers, ooohhh... a is equal to 1, becuase the user entered 1, not 2, so I will keep going!!!
Now, it goes all the way back to the beginning of the do-while loop. And what does it see first? You guessed it.
This cout << "[1] Start\n[2] Return\n";.
You will need to move this statement outside of the do-while loop if you dont want it to repeat. Also, I might have gotten your question wrong, but this is how I took it from the information you've given. If I did get your question wrong, please elaborate on what is wrong and be more specific.