❔ 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
mtreit
mtreit14mo ago
Do you know what Console.Read does?
JakenVeina
JakenVeina14mo ago
because the integer value of the character 7 is 55
mtreit
mtreit14mo ago
Console.Read reads a single character.
zielona_pomarańcza
So the number that i input here is ins ASCII ? Thanks for article i will read it
JakenVeina
JakenVeina14mo ago
Unicode
zielona_pomarańcza
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 ^^
JakenVeina
JakenVeina14mo ago
what is it that you're trying to do? that's always the first question
mtreit
mtreit14mo ago
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
zielona_pomarańcza
Oh i think mtreit understood me correctly I will try it after reading article form u big thanks ^^
Servator
Servator14mo ago
Just use "Console.ReadLine()" instead of "Console.Read()"
Accord
Accord14mo ago
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.