0
Variables
I need a variable to equal an answer like right or left or yes or no. How do I make it do that?
3 Antworten
+ 1
store it in a string even if it's a binary state of values (cin will give you a string) and then compare it to your exoected values (beware of the lower/upper case)
0
You could create a boolean variable isRight or isLeft.
0
or
enum Answer {
Yes = 0,
No
};
You use it like Answer::Yes, which gives 0.