0
Converting Negative Numbers (C#)
Do anyone know how to convert also Negative Numbers from your input? For example you used " name = Convert.ToInt32(Console.ReadLine); " then after run the code if you wrote Negative Number you get an Error Compilation.
4 ответов
+ 1
1. It's Console.ReadLine() not Console.ReadLine
2. Convert.ToInt32() can convert negative integer too.
3. If your number is negative non-integer, use Convert.ToDouble() instead.
+ 1
Yes smart keyboard sometimes bring inconvenience in coding. For example it will keep helping us to correct our "spelling mistakes" into "Console. Write Line" 🤷♂️
0
1. Mistakes happens.
2. I don't think it can't, i just think it's because of the ReadLine command. Like it interpret "-" wrong but im only guessing.
3. Thanks, I'll just try your way. (;
0
Ok, you know... I'm stupid. Convert. ToInt32 actually works but my awsome keyboard makes space after "-" so it looks like "- 3" Sorry to bother...