❔ Simple Console.WriteLine question
Hey im wondering why with constant my {} ( dont know how its called ) gives me value of pi with 5 digits after dot.
And why when i input value from keyboard it gives me random 55
12 Replies
Do you know what Console.Read does?
because the integer value of the character
7
is 55
Console.Read Method (System)
Reads the next character from the standard input stream.
Console.Read reads a single character.
So the number that i input here is ins ASCII ? Thanks for article i will read it
Unicode
Hmm could u give me some hint then what method will fix it ? Im not sure if its possible cuz the Math.Pi method was in my book and i tried something on my own ^^
what is it that you're trying to do?
that's always the first question
If you are trying to read a floating point value from the console, use Console.ReadLine to get the input as a string and then parse that into a double
Oh i think mtreit understood me correctly
I will try it after reading article form u big thanks ^^
Just use "Console.ReadLine()" instead of "Console.Read()"
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.