0

how can i input character in arrays with keyboard on c#

27th Feb 2020, 3:02 PM
Slaugther
Slaugther - avatar
3 Réponses
+ 3
Use `Console.Read`. But you need to cast the returned value (from `Console.Read`) type into `char` before you assign it to the desired specific array element. char[] buffer = new char[10]; for(int i = 0; i < 10; i++) { buffer[i] = (char)Console.Read(); } Console.WriteLine(buffer); (Edited)
27th Feb 2020, 3:22 PM
Ipang
+ 3
Exampe 1: string[] si = Console.ReadLine().Split(' '); Example 2: do{ si=Console.ReadLine(); if(si!=null){ //your code ... //Console.WriteLine(si); } }while(si != null);
27th Feb 2020, 4:06 PM
JaScript
JaScript - avatar
+ 2
thx
27th Feb 2020, 5:39 PM
Slaugther
Slaugther - avatar