0
how can i input character in arrays with keyboard on c#
3 Answers
+ 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)
+ 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);
+ 2
thx