using System; using System.Collections.Generic; using System.Text; namespace stuConsole { //定义学生类 class student { //字段定义 private string name; //姓名 private string no; //学号 private double engScore; //英语成绩 private double cScore; //C++成绩 private double mathScore; //数学成绩 //定义属性,通过属性访问、修改相应字段 public string Name { set{name = value;} get{return name;} } public string No { set{no = value;} get{return no;} } public double EngScore { set{engScore = value;} get{return engScore;} } public double CScore { set{cScore = value;} get{return cScore;} } public double MathScore { set { mathScore = value; } get { return mathScore; } } //输入相应的数据 public void inputText() { Console.WriteLine("请输入姓名:"); Name = Console.ReadLine(); Console.WriteLine("请输入学号:"); No = Console.ReadLine(); Console.WriteLine("请输入英语成绩:"); EngScore = double.Parse(Console.ReadLine()); Console.WriteLine("请输入C++成绩:"); CScore = double.Parse(Console.ReadLine()); Console.WriteLine("请输入数学成绩:");
温馨提示:答案为网友推荐,仅供参考