How to use the input value?

I'm now working with a robot using C++, and I want the robot to react based on user input. For example, I want the robot to move when input is "Yes", how can I express the if statement "if input is yes"?
i wouldn't use if statements, but some sort of data tree that holds inputs.

but here you go:
1
2
3
4
5
6
7
8
9
10
11
enum INPUT_TYPE
{
Move_No,
Move_Yes,
};


INPUT_TYPE input = Move_Yes;

if(input == Move_Yes)
//code 
I don't know how you would actually move the robot, but here is everything else.

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <string>

int main(void) {
     std::string answer;
     std::cout << "Yes or No: ";
     std::cin >> answer;
     if(answer == "Yes")
          // move robot
     return 0;
}
Thank you so much, both of you! I just tried your codes and both of them worked, thx a lot:D
Topic archived. No new replies allowed.