我正在制作一个刽子手游戏,我希望能够从控制台获取用户输入并将其分配给数组中的值。
string hangWord;
char[] hangArray;
console.WriteLine("Please enter your hangman word.");
hangWord = console.Readline();
char[] hangArray = {hangWord}
如何做到这一点,以便用户输入像"淋浴" 索引将是 hangArray [] = {" s"," h"," o"," w"," e", " R"}; 自动?
答案 0 :(得分:1)
char[] hangArray = hangWord.ToCharArray()