0

input with text turns results in zero

int a; cout << "A goblin swiftly attacks what do you do \n"; cin >> a; cout << a; return 0; i want to test how to input users answers onto the screen. yet it just results in the question then zero

27th Sep 2017, 12:52 AM
Matthew LaBelle
Matthew LaBelle - avatar
4 Answers
+ 1
When you click on "Run", you will get a prompt to enter values. Enter whatever you want there and it will be taken as the argument for your cin.
27th Sep 2017, 12:57 AM
Frédéric Charette
Frédéric Charette - avatar
+ 1
you are right, I didn't even check his variable type.
27th Sep 2017, 1:04 AM
Frédéric Charette
Frédéric Charette - avatar