在控制台应用程序中,Console.ReadLine()用于获取键盘上输入的字符串;
string str = Console.ReadLine();
若需要输入整数需进行转换:
int num = Convert.ToInt32(str);
输入小数的转换:
double num1 = Convert.ToDouble(str);
在控制台应用程序中,Console.ReadLine()用于获取键盘上输入的字符串;
string str = Console.ReadLine();
若需要输入整数需进行转换:
int num = Convert.ToInt32(str);
输入小数的转换:
double num1 = Convert.ToDouble(str);