Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include<iostream>
- using namespace std;
- int main()
- {
- int value;
- cout << "Would you please enter the command " << endl;
- cout << " _______________________" << endl;
- cout << " 1- go ahead |" << endl;
- cout << " _______________________" << endl;
- cout << " 2- make a left turn |" << endl;
- cout << " _______________________" << endl;
- cout << " 3- make a right turn |" << endl;
- cout << " _______________________" << endl;
- cout << " 4- go back |" << endl;
- cout << " _______________________" << endl;
- cout << " 0- stop everything |" << endl;
- cout << " _____________________________________________________" << endl;
- cin >> value;
- switch (value)
- {
- case '1':
- while (int value == 1)
- {
- cout << " * go ahead " << endl;
- if (value == 0)
- {
- break;
- }
- }
- break;
- case '2':
- cout << " * turn left " << endl;
- break;
- case '3':
- cout << " * turn right " << endl;
- break;
- case '4':
- cout << " * reverse " << endl;
- break;
- case '0':
- cout << " !!!Stop!!! " << endl;
- break;
- }
- return 0;
- }
- int value = 0;
- do{
- cin >> value;
- switch(value){
- case 1:
- cout << "go ahead" << endl;
- break;
- case 2:
- cout << "turn left" << endl;
- break;
- case 3:
- cout << "turn right" << endl;
- break;
- case 4:
- cout << "reverse" << endl;
- break;
- case 0:
- cout << "stop" << endl;
- break;
- }
- }while(value!=0);
- switch (value)
- {
- case 1:
- for (value == 1)
- {
- cout << " * go ahead " << endl;
- if (value == 0)
- {
- break;
- }
- }
- break;
- case 2:
- cout << " * turn left " << endl;
- break;
- case 3:
- cout << " * turn right " << endl;
- break;
- case 4:
- cout << " * reverse " << endl;
- break;
- case 0:
- cout << " !!!Stop!!! " << endl;
- break;
- }
Add Comment
Please, Sign In to add comment