Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char option, askExit;
- float startPos, speed;
- do
- {
- system("cls");
- cout << "Type of robot (B - biped, H - hexapod, T - two-wheeled): ";
- while(1)
- {
- cin >> option;
- if(option=='b'||option=='B')
- {
- speed = 0.15;
- break;
- }
- else if(option=='h'||option=='H')
- {
- speed = 0.07;
- break;
- }
- else if(option=='t'||option=='T')
- {
- speed = 0.45;
- break;
- }
- else
- cout << "Type of robot again (B - biped, H - hexapod, T - two-wheeled: ";
- }
- cout << "Initial position of the robot (m): ";
- cin >> startPos;
- cout << "\nPosition of robot in 10 sec:\n";
- cout << "Time (s)\tPostion (m)\n";
- for(int i=1;i<=10;i++)
- cout << i << "\t\t" << startPos + speed*i << "\n";
- cout << "\nRepeat the whole process? (Y/N): ";
- cin >> askExit;
- } while (askExit=='y'||askExit=='Y');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement