C
C#3y ago
maroonlol

My code works - but is shows invalid string at the beggening for no reason

It works but it disiplays invalid string at the start i want to get rid of it https://github.com/AbdulRaheemNazir/MiniApps/blob/main/Caesar%20Cipher%20Problem
GitHub
MiniApps/Caesar Cipher Problem at main · AbdulRaheemNazir/MiniApps
Contribute to AbdulRaheemNazir/MiniApps development by creating an account on GitHub.
5 Replies
Kukuba008
Kukuba0083y ago
still need help ?
maroonlol
maroonlolOP3y ago
yep
Kouhai
Kouhai3y ago
@Abdul Raheem Nazir Change this line choice = (char)Console.Read(); to choice = Console.ReadKey().KeyChar; The reason you need to make this change is Console.Read() reads the first character in AFTER you've pressed enter, pressing enter adds \r\n characters Which makes the next call to Console.ReadLine() read these characters
maroonlol
maroonlolOP3y ago
With KeyChar it will allow me to only allow to type one digit (so 1-9) in future I will add more options so i will have more options above 20
Kouhai
Kouhai3y ago
Change it to ReadLine then and parse the returned string
Want results from more Discord servers?
Add your server