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?

5th Jul 2016, 4:41 AM
Bryce Cindrich
Bryce Cindrich - avatar
3 Respostas
+ 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)
5th Jul 2016, 6:33 AM
Dorian
0
You could create a boolean variable isRight or isLeft.
5th Jul 2016, 1:17 PM
Garme Kain
Garme Kain - avatar
0
or enum Answer { Yes = 0, No }; You use it like Answer::Yes, which gives 0.
5th Jul 2016, 1:18 PM
Garme Kain
Garme Kain - avatar