+ 1

It confuses, why we have to convert number input into integer when it is already int?

3rd May 2016, 7:33 PM
Siim Bobkov
Siim Bobkov - avatar
3 odpowiedzi
+ 1
That's because, when you use Console.ReadLine(), it accepts a String. If you do not convert to Int or Double, it'll produce errors.
17th Jun 2016, 7:29 PM
erwinmesi
erwinmesi - avatar
+ 1
in c# user input like a textbox are usually string, so you have to convert them to int or double to use. C# wont convert anything itself untill you say!
24th Jun 2016, 8:59 PM
behzad
0
When using C# you have to be specific when programming, that's why you have to convert number input into an integer when it is already. Also, that goes the same for data types, functions(you will learn that in later ;), etc.
7th May 2016, 3:35 PM
Felix Alexis
Felix Alexis - avatar