COnsole.Read()方法用于获得用户输入任何值的首字符的ASCII值
COnsole.ReadLine()方法用于将获得的数据保存在字符串变量中
例如:
string x=Convert.ToString(Console.Read());
Console.WriteLine(x);
当输入:qw 输出:113
当输入:q 输出:113
可证明,输出的都是首字符q的ASCII值
而:
string x=Convert.ToString(Console.ReadLine());
Console.WriteLine(x);
当输入:qw 输出:qw
当输入: q 输出:q
COnsole.ReadLine()方法用于将获得的数据保存在字符串变量中
例如:
string x=Convert.ToString(Console.Read());
Console.WriteLine(x);
当输入:qw 输出:113
当输入:q 输出:113
可证明,输出的都是首字符q的ASCII值
而:
string x=Convert.ToString(Console.ReadLine());
Console.WriteLine(x);
当输入:qw 输出:qw
当输入: q 输出:q
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号