Getting user input lesson | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Getting user input lesson

I would expect the question What is your name? to show up before I am requested to enter something. Instead I am requested to enter something. Afterwards the question and answer show up at the same time. Why does that happen?

23rd Mar 2017, 10:43 AM
Connie van Niekerk
Connie van Niekerk - avatar
2 Answers
+ 5
Thats notpossibe in Soloearn's playground. Try other pc softwares
23rd Mar 2017, 10:47 AM
Meharban Singh
Meharban Singh - avatar
0
If it's on sololearns playground you need to enter input before it shows the output. If it's on e.g. Code::Blocks (which I use), it works in that direction you make it. Example on playgrounds: //All the standard. int main() { string name; cout << "Hello, please enter your name"; cin >> name; return 0; } It makes you input your name first. If it's on e.g. Code::Blocks: It outputs: Hello, please enter your name //userinput
23rd Mar 2017, 10:52 AM
Søren