0
cin >> question
Hey there. How do I create a question/command that asks the user for input, e.g. âType in numberâ. It should be very simple but I just started with the tutorials...
3 RĂ©ponses
+ 2
cout<<"Type in number";
0
Thank you. I did basically that ( cout << âType in a, b, or c> â; see below) but the text was printed to the screen after I was informed to type in something. Maybe itâs because Iâm working with my iPad... I will try some other things maybe ;)
0
int main() {
cout << "Why are you learning? Type in 1, 2 or 3: " << endl;
string a = "I am learning C++";
string b = "Because it is fun";
string c = "Well, ... I don't know";
int number = 0;
cin >> number;
switch (number) {
case 1:
cout << a;
break;
case 2:
cout << b;
break;
case 3:
cout << c;
break;
default:
cout << "Wrong input";
}
}