❔ 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
mtreit2y ago
Do you know what Console.Read does?
JakenVeina
JakenVeina2y ago
because the integer value of the character 7 is 55
mtreit
mtreit2y 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
JakenVeina2y 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
JakenVeina2y ago
what is it that you're trying to do? that's always the first question
mtreit
mtreit2y 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
Servator2y ago
Just use "Console.ReadLine()" instead of "Console.Read()"
Accord
Accord2y 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.
Want results from more Discord servers?
Add your server