C#基礎:輸入輸出函式的使用
阿新 • • 發佈:2018-12-26
C#基礎知識:輸入與輸出函式,
需要引用using system;
- //輸出:System.Console.WriteLine()
- Console.WriteLine("Hello World!!!");//完成後換行
- Console.Write("hello world");//完成後不換行
- //輸入
- string str = Console.ReadLine();//輸入一行
- Console.WriteLine(str);
- Console.WriteLine("--------------");
- char ch =(char)Console.Read();//輸入一個字元
- Console.WriteLine(ch);
- Console.WriteLine("---------------");
- int n = Convert.ToInt32(Console.ReadLine());//輸入數字
- Console.WriteLine(n);
- Console.ReadKey();