How can i get my program to accept input from users...like a yes or no and after then how can i link it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i get my program to accept input from users...like a yes or no and after then how can i link it

9th Apr 2018, 10:53 AM
nichole
2 Answers
+ 1
cin >> varName;
9th Apr 2018, 11:07 AM
Ariela
Ariela - avatar
+ 1
You can use a method for input. Like Ariela said, you could use cin for simple inputs like yes or no. If your input has spaces in it, use getline: string input = ""; cin >> input; if (input == "yes") { //Do something } // for spaced input getline(cin, input);
9th Apr 2018, 1:15 PM
Zeke Williams
Zeke Williams - avatar