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

15th May 2017, 12:12 PM
Exterior Alpha
4 ответов
+ 1
Console.Read() reads the charecter change the line to. int age = Int32.Parse(Console.ReadLine());
15th May 2017, 12:29 PM
MR Programmer
MR Programmer - avatar
15th May 2017, 12:12 PM
Exterior Alpha
0
it says no output now
15th May 2017, 12:33 PM
Exterior Alpha
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
15th May 2017, 12:34 PM
nouseforname
nouseforname - avatar