0
convert.todouble and console.readline
if I write this double age = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("You are {0} years old", age); and I enter 4.4 it writes 4.4. if I write 4,4 it writes 44. why does this happen?
4 ответов
+ 1
in Europe we use comma for floating point numbers. so I made a typo by writing 4,4 as an input. I just would like to know why it ignored the comma and it didn't report an error like when I type a character instead of a float
+ 1
Ahh, it's because the Convert.ToDouble() function already expects a string input with a group separator (,) which it simply ignores.
That thing, happens only for comma.
0
4,4? as in (four-comma-four)? or that was just a typographical error?
0
thank you