0

Explain this thanks

I hadn't declared any variables so I tested it with a word or a number and its output is always a number Console.WriteLine(Console.Read());

22nd Aug 2019, 1:47 PM
MasterofBeginning
MasterofBeginning - avatar
2 odpowiedzi
0
You should tell the program what is the data type of input. For string,try this string str=Console.Read(); Console.WriteLine(str);
22nd Aug 2019, 2:10 PM
Ketchup🍅
Ketchup🍅 - avatar
0
[Microsoft Documentation] https://docs.microsoft.com/en-us/dotnet/api/system.console.read `Read` method reads next character from the standard input stream. Internally treats the character read as number, based on its ASCII code (most likely but may not always be). [Difference between Read & ReadLine] https://stackoverflow.com/questions/6825943/difference-between-console-read-and-console-readline
22nd Aug 2019, 2:59 PM
Ipang