console.read和console.readline区别.int n; Console.WriteLine("打印1-n的自然数!"); Console.Write("请输入n的值:"); n =Convert .ToInt32 ( Console.ReadLine()); for (int i = 1; i
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 18:40:10
console.read和console.readline区别.int n; Console.WriteLine("打印1-n的自然数!"); Console.Write("请输入n的值:"); n =Convert .ToInt32 ( Console.ReadLine()); for (int i = 1; i
console.read和console.readline区别.
int n;
Console.WriteLine("打印1-n的自然数!");
Console.Write("请输入n的值:");
n =Convert .ToInt32 ( Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.Write(i + ",");
}
Console.Read();
这里第四行括号里面的readLine换成read会怎么样.
console.read和console.readline区别.int n; Console.WriteLine("打印1-n的自然数!"); Console.Write("请输入n的值:"); n =Convert .ToInt32 ( Console.ReadLine()); for (int i = 1; i
Read()读取一个字符,返回该字符的ascII码,
ReadLine()是读取一行,返回值是string类型.