C#学生成绩管理(控制台程序)功能:录入学生基本信息 如姓名,学号,各科成绩,输入各科成绩后就求各科成绩总分和平均分,做过的朋友帮帮忙,记得加上注释,偶是新手,谢谢。

解决方案 »

  1.   


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace Students
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.Write("请输入学生姓名:");
                string Name = Console.ReadLine().ToString();
                Console.Write("请输入学号:");
                uint StudentID = uint.Parse(Console.ReadLine());
                Console.Write("请输入一共要考几科");
                uint SubjectsNO = uint.Parse(Console.ReadLine());
                Console.WriteLine("请输入各科名称:");
                string[] Subjects = new string[SubjectsNO];//装成绩的数组
                for(int i=0;i<Subjects.Length;i++)
                {
                    Subjects[i] = Console.ReadLine().ToString();
                }
                Console.Write("请输入各科分数:");
                int[] Fractions= new int[SubjectsNO];//装分数的数组
                for (int i = 0; i < Subjects.Length; i++)
                {
                        Console.WriteLine("{0}", Subjects[i]);
                        Fractions[i] = int.Parse(Console.ReadLine());
                }
                Console.WriteLine("您输入的信息如下:");
                Console.WriteLine("姓名:{0}",Name);
                Console.WriteLine("学号:{0}",StudentID);
                Console.WriteLine("一共考试科目是{0},科目和分数如下:",SubjectsNO);
                for (int i = 0; i < Subjects.Length; i++)//显示科目和成绩
                {
                    Console.WriteLine("{0}:{1}",Subjects[i],Fractions[i]);
                }
                Console.WriteLine("分数总和是:{0}", Fractions.Sum());//求和
                Console.WriteLine("平均分数是:{0}", Fractions.Average());//求平均数
            }
        }
    }学程序要动手做。
      

  2.   

    你自己都把程序说的很明白了嘛..
    为什么自己会写不出来呐...
    多注意点思路..
    OOP要学好
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace XveJiGuanLi
    {
        public class XveSheng
        {
            private int _XveHao;
            private string _XingMing;
            private int _NianLing;
            private string _XingBie;
            private string _ZhuanYe;
            public int _Count=0;        public XveSheng(int Count,int XveHao,string XingMing,string XingBie,int NianLing,string ZhuanYe)//构造函数
            {
                this._Count=Count;
                this._XveHao = XveHao;
                this._XingMing = XingMing;
                this._XingBie = XingBie;
                this._NianLing = NianLing;
                this._ZhuanYe = ZhuanYe;
            }        public static void PanDuan(XveSheng[] studentArray)//判断操作
            {            string str = Console.ReadLine();
                switch (str)
                {
                    case "1": XveSheng.XiuGai();
                        break;
                    case "2": XveSheng.TianJia(studentArray);
                        break;
                    case "3": Console.WriteLine("输入删除学生的序号;");
                        XveSheng.ShanChu(studentArray);
                        break;
                    default:
                        break;
                }        }
            public static void XianShi(XveSheng[] studentArray)//显示学生属性表
            {            Console.WriteLine("                             学生学籍管理系统");
                Console.WriteLine("********************************************************************************");
                Console.WriteLine("\t序号\t学号\t姓名\t性别\t年龄\t专业");
                foreach (XveSheng s in studentArray)
                {
                    Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}\t{5}",s._Count,s._XveHao,s._XingMing,s._XingBie,s._NianLing,s._ZhuanYe);                
                }
                Console.WriteLine("\n\t1.->>修改(未完成)\t2.->>添加\t3.->>删除");
                //XveSheng.ShanChu(XveSheng[] studentArray);
            }
           
            public static void XiuGai()//修改操作
            { 
            }        public static void TianJia(XveSheng[] studentArray)//添加操作
            {
               Console.WriteLine("输入添加的序号:");
               string x = Console.ReadLine();
               int xv=Convert.ToInt32(x);
                  Console.WriteLine("输入添加的学号;");
                  string x1 = Console.ReadLine();
                  int xve = Convert.ToInt32(x1);
                  Console.WriteLine("输入添加的姓名;");
                  string x2 = Console.ReadLine();
                  Console.WriteLine("输入添加的性别;");
                  string x3 = Console.ReadLine();
                  Console.WriteLine("输入添加的年龄:");
                  string x4 = Console.ReadLine();
                  int nian = Convert.ToInt32(x4);
                  Console.WriteLine("输入添加的专业");
                  string x5 = Console.ReadLine();
                  for (int i = 0; i < studentArray.Length; i++)
                  {
                      if (studentArray[i]._Count == 0)
                      {
                          studentArray[i]._Count = xv;
                          studentArray[i]._XveHao = xve;
                          studentArray[i]._XingMing = x2;
                          studentArray[i]._XingBie = x3;
                          studentArray[i]._NianLing = nian;
                          studentArray[i]._ZhuanYe = x5;
                          break;
                      }
                  }
                  XveSheng.XianShi(studentArray);
                  XveSheng.PanDuan(studentArray);
            }        public static void ShanChu(XveSheng[] studentArray)//删除操作
            {
                int i = 0;
                string x=Console.ReadLine();
                i=Convert.ToInt32(x);
                studentArray[i - 1]._Count=0;
                studentArray[i - 1]._NianLing = 0;
                studentArray[i - 1]._XingBie = "";
                studentArray[i - 1]._XingMing = "";
                studentArray[i - 1]._XveHao = 0;
                studentArray[i - 1]._ZhuanYe = "";
                XveSheng.XianShi(studentArray);
                XveSheng.PanDuan(studentArray);
            }
        }
        class Program
        {
            static void Main(string[] args)
            {
                XveSheng stud1 = new XveSheng(1,1002112,"", "男", 22, "信息与计算科学");
                XveSheng stud2 = new XveSheng(2, 1002103, "", "男", 21, "信息与计算科学");
                XveSheng stud3 = new XveSheng(3, 1002104,"", "男", 21, "信息与计算科学");
                XveSheng stud4 = new XveSheng(4, 1002122, "", "女", 21, "应用数学");
                XveSheng stud5 = new XveSheng(5, 1001121, "", "女", 20, "应用物理");
                XveSheng stud6 = new XveSheng(0, 0, "", "", 0, "");
                XveSheng stud7 = new XveSheng(0, 0, "", "", 0, "");
                XveSheng stud8 = new XveSheng(0, 0, "", "", 0, "");
                XveSheng stud9 = new XveSheng(0, 0, "", "", 0, "");
                XveSheng stud10 = new XveSheng(0, 0, "", "", 0, "");
                XveSheng[] Student = new XveSheng[]{stud1,stud2,stud3,stud4,stud5,stud6,stud7,stud8,stud9,stud10};
                XveSheng.XianShi(Student);
                XveSheng.PanDuan(Student);
                Console.ReadLine();
            }
        }
    }
    有类似之处,能看懂就好,初学者或许有帮助的。