0

How to ask a series of questions and get user inputs in C#

Hi, so I've been fiddling with my C# code trying to get it to allow me to ask a series of questions. So basically after one question is answered (the user has inputted the data and pressed enter), the next question should pop up and the next User input box should pop up. For example: Q1. What is your name? [User inputs data and presses enter] Q2. How old are you? [User inputs data and presses enter] Q3. What programming language are you currently studying? [User inputs data and presses enter] [Finishes] Below is a snippet of my code, what's wrong with it? ------------------------------------------------------------------------------------- string name; string age; string pLang; Console.WriteLine("What is your name?"); name = Console.ReadLine(); Console.WriteLine("My name {0}", name); Console.WriteLine("How old are you?"); age = Console.ReadLine(); Console.WriteLine("{1}", age); Console.WriteLine("What programming language are you currently studying?"); pLang = Console.ReadLine(); Console.WriteLine("{1}", pLang); -------------------------------------------------------------------------------------

11th Oct 2018, 10:51 AM
ASDFG
ASDFG - avatar
2 Respuestas
+ 1
If you're running it on SoloLearn you can't achieve what you want and you have to write all the input when you execute it. Remember that every programming languages pn SoloLearn is not executed on your device. It is executed on SoloLearn servers that only gives you the input
11th Oct 2018, 11:12 AM
Daniele Bonomi
Daniele Bonomi - avatar
0
Daniele Bonomi - Oh ok that makes sense, however is the way I formatted my code correct?
11th Oct 2018, 4:05 PM
ASDFG
ASDFG - avatar