Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int mode = 0;
- int wait = 0; //the wait is to slow down button inputs and i had the same problem before i put that bit in
- int selection = 0;
- do{
- cout << "Enter 99 for 'btnSELECT': " ;
- cin >> selection;
- switch(selection)
- {
- case 99: // btnSELECT
- {
- if (wait == 0)
- {
- cout << "reached first if statement\n";
- cout << "mode is: " << mode << endl;
- mode++;
- cout << "mode incremented to: " << mode << endl;
- wait = 1;
- }
- if (mode >= 5)
- {
- cout << "reached second if statement\n";
- mode = 0;
- }
- switch(mode)
- {
- case 1:
- {
- cout << "Reached case 1.\n";
- mode++;
- break;
- }
- case 2:
- {
- cout << "Reached case 2.\n";
- mode++;
- break;
- }
- case 3:
- {
- cout << "Reached case 3.\n";
- mode++;
- break;
- }
- case 4:
- {
- cout << "Reached case 4.\n";
- mode++;
- break;
- }
- case 5:
- {
- //only time i got to here was when i added mode++; to the end of case 4 to force it to go to the next 1
- cout << "Reached case 5.\n";
- mode++;
- break;
- }
- case 6:
- {
- cout << "Reached case 6.\n";
- mode = 1;
- break;
- }
- default: cout << "You have reached the default case of switch(mode). Mode is: " << mode << "\n";break;
- }
- break;
- }
- default: cout << "Reached 'default' of switch(selection). Mode is: " << mode << "\n\n";break;
- }
- } while(mode < 7);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement