0
If else
I'm trying to make something similar to your adult child code but no matter what I put in it's always adult
4 odpowiedzi
+ 1
Console.Read() reads the charecter change the line to.
int age = Int32.Parse(Console.ReadLine());
0
it says no output now
0
This is cause "Console.Read()" reads char. And wenn you print and compare it, it will use its Ascii-Code.
You have to convert it first:
int age = Int32.Parse(Console.ReadLine());
By the way, in any case of your program is not running as expected. Put some debug logging inside to find out what happen in detail.
int age = Int32.Parse(Console.ReadLine());
Console.WriteLine("Adult: " + age);
have fun