C#编程题,运行时出错
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSy...
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 实验4{ class Program { static void Main(string[] args) { int functionSelect; Console.WriteLine("\t\t\t*********************************"); Console.WriteLine("\t\t\t*\t学生信息管理系统\t*"); Console.WriteLine("\t\t\t*\t\t\t\t*"); ; Console.WriteLine("\t\t\t*\t\t\t\t*"); Console.WriteLine("\t\t\t* 1.添加 2.修改 3.删除 4.查询 *"); Console.WriteLine("\t\t\t*********************************"); functionSelect = Convert.ToInt32(Console.ReadLine()); switch (functionSelect) { case 1: { Student a = new Student(); a.addStudent(); break; } case 2: break; case 3: break; case 4: break; } } } class Student { string name; string id; string english; string chinese; string math; int total; float average; public void addStudent() { Student[] stu = new Student[3]; for (int i = 0; i < 4; i++) { Console.WriteLine("请输入姓名:"); stu[i].name = Console.ReadLine(); Console.Write("请输入学号:"); stu[i].id = Console.ReadLine(); Console.Write("请输入英语成绩:"); stu[i].english = Console.ReadLine(); Console.Write("请输入语文成绩:"); stu[i].chinese = Console.ReadLine(); Console.Write("请输入数学成绩:"); stu[i].math = Console.ReadLine(); } } }}
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询