1. 程式人生 > >C#基礎:輸入輸出函式的使用

C#基礎:輸入輸出函式的使用

 C#基礎知識:輸入與輸出函式,

需要引用using system;

  1.                //輸出:System.Console.WriteLine()
  2.             Console.WriteLine("Hello World!!!");//完成後換行
  3.             Console.Write("hello world");//完成後不換行
  4.               //輸入
  5.             string str = Console.ReadLine();//輸入一行
  6.             Console.WriteLine(str);
  7.             Console.WriteLine("--------------");
  8.             char ch =(char)Console.Read();//輸入一個字元
  9.             Console.WriteLine(ch);
  10.             Console.WriteLine("---------------");
  11.             int n = Convert.ToInt32(Console.ReadLine());//輸入數字
  12.             Console.WriteLine(n);
  13.             Console.ReadKey();