一、控制台应用程序的一些基础命令
1.Console.WriteLine()
输入字符串到控制台中后换行,括号里一般是(“字符串”,变量列表),也可以直接是字符串or变量列表。
2.Console.ReadLine()
读取控制台中的字符串后换行,当输入字符串时,此函数会自动读取到刚输入的字符串。
3.Console.ReadKey()
等待键盘输入,如果没有这一句,程序运行完之后会直接退出,一闪而过,看不到结果。
4.Console.Clear()
清楚控制台显示的内容。
二、示例代码
输入4个数,计算乘积
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int firstNumber, secondNumber, thirdNumber, fouthNumber;
double firstNumber1, secondNumber1, thirdNumber1, fouthNumber1;
Console.WriteLine("Give me a number:");