Hello.cs文件
using System; //引用了一个叫System的名空间 class easyInput //类的名字与文件名(Hello.cs)不同也 无所谓 { public static void Main() { string strName; //声明一个string类型的值变量 Console.Write("please input your name:"); //输出一句话,但不换行 strName = Console.ReadLine(); //从键盘读入用户的输入,用户按下回车表示输入结束 Console.WriteLine("hello, {0}!", strName); //格式化输出hello + 刚才用户输入的信息 } }
效果如下:
时间: 2025-01-05 10:03:14