摘要:
类和对象 class Dog { //共同特征,品种(字段) public string breed; //行为, 犬叫(方法) public void Shout () { Console.WriteLine(breed + "汪汪汪!"); } } class Program { static 阅读全文
摘要:
异常 当程序出现异常时,如果不处理程序就可能会崩溃。 class Program { static void Main(string[] args) { try { Console.WriteLine("请输入一个数字"); int i = Convert.ToInt32(Console.ReadL 阅读全文
摘要:
数组的定义 using System; class program { static void Main(sting [ ] args) { //定义一个int类型的数组x int [ ] x; //指定数组x中有3个元素 x =new int [3]; //上面的两句合并成一句:int [ ] x 阅读全文