using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 变量定义在main函数外面 { class Program { public int a;//变量定义在外面 struct student { public int sno; public string name; public string sex; } static void Main(string[] args) { Program pro = new Program(); Console.Write("请输入班级人数:"); pro.a= int.Parse(Console.ReadLine()); double []fenshu=new double[pro.a]; student stu=new student();//结构体初始化类,绿色的表示类 Console.ReadLine(); } } }