+ 2
How to use multiple Console.ReadLine()
What if you ask for to different inputs. One as string and one as int. Like string yourName = Console.ReadLine(); Console.WriteLine("Your name is {0}",yourName ); int yourAge = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Your age is {0}",yourAge ); I can only input the fhirst one but its not asking for the other. And is it possible to make a question for what your asking? Like: please fill in your name.
5 Respostas
+ 2
When you are entering multiple inputs into this mobile app you must enter all inputs you expect to use at the same time...just separate them by different lines...for example:
int x = Console.ReadLine();
int y = Console.ReadLine();
Console.WriteLine(x);
Console.WriteLine(y);
You would have to enter both x and y at the same time just putting the y value on a new line like this:
3
6
srry long explanation, but dont worry on an actual computer you will be prompted however many times you ask for user input
+ 1
Maybe try writing your code like this
string yourName = Console.ReadLine ();
Console.WriteLine ("Your name is, " + yourName);
int yourAge = Convert.ToInt32 (Console.ReadLine ());
Console.WriteLine ("Your age is, " + yourAge);
Console.ReadKey ();
I use XamarinStudio so I don't know if it will work in visual studio.
+ 1
i think after you saw tge output of first Console.Writelin, you should press Enter another time for console to go to the next line.or to be sure you can write it like this:
string yourName = Console.ReadLine();
Console.WriteLine("Your name is {0}",yourName );
Console.ReadLine ();
int yourAge =
Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Your age is {0}",yourAge );
____________
or you can just use Parse when youre gonna give the console the value for int yourAge:
int yourAge=int.parse. (Console.ReadLine ());
0
it says when you go to input something "split multiple inputs into separate lines"
- 2
The real program you can insert as many as much as possible Console.ReadLine() and ask the user to input data in it, but in this application, it can't command more than one Console.ReadLine() because its connected and do with connection, but not in internal