以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Dot NET,C#,ASP,VB 』  (http://bbs.xml.org.cn/list.asp?boardid=43)
----  C#控制台学生成绩管理系统源码  (http://bbs.xml.org.cn/dispbbs.asp?boardid=43&rootid=&id=43496)


--  作者:蜾蠃赢羸螟蛉
--  发布时间:3/1/2007 2:09:00 AM

--  C#控制台学生成绩管理系统源码
学校要求我们用C#控制台应用程序写一个学生成绩管理系统,但是马上要开校了,假期耍得太厉害了,基本上不会写了,嘿嘿,只是把框架搭起了,望那位大虾能帮小弟补充完整啊,谢先!(有少数的语法错误,主要是大小写问题~嘿嘿~~)

using System;
using System.IO;
using System.Text;

namespace @case
{

    //学生成绩类
    public class StuScoreSem2
    {
        int eng;               //英语
        int math;              //数学
        int sport;             //体育
        int datastructure;     //数据结构
        int operatingSystem;   //操作系统

        //构造器
        public StuScoreSem2()
        {
            this.eng = 0;
            this.math = 0;
            this.sport = 0;
            this.datastructure = 0;
            this.operatingSystem = 0;
        }

        //构造器
        public StuScoreSem2(int eng, int math, int sport, int datastructure, int operatingSystem)
        {
            this.eng = eng;
            this.math = math;
            this.sport = sport;
            this.datastructure = datastructure;
            this.operatingSystem = operatingSystem;
        }

        //英语属性
        public int Eng
        {
            get
            {
                return eng;
            }
            set
            {
                this.eng = value;
            }
        }

        //数学属性
        public int Math
        {
            get
            {
                return math;
            }
            set
            {
                this.math = value;
            }
        }

        //体育属性
        public int Sport
        {
            get
            {
                return sport;
            }
            set
            {
                this.sport = value;
            }
        }

        //数据结构属性
        public int Datastucture
        {
            get
            {
                return datastructure;
            }
            set
            {
                this.datastructure = value;
            }
        }

        //操作系统属性
        public int OperatinSystem
        {
            get
            {
                return operatingSystem;
            }
            set
            {
                this.operatingSystem = value;
            }
        }
    }

    //学生信息类
    public class StuInfo
    {
        int id;          //学号
        string name;     //姓名
        string sex;      //性别
        int age;         //年龄

        //构造器
        public StuInfo()
        {
            this.id = 0;
            this.name = "";
            this.sex = "";
            this.age = 0;
        }

        //构造器
        public StuInfo(int id, string name, string sex, int age)
        {
            this.id = id;
            this.name = name;
            this.sex = sex;
            this.age = age;
        }

        //学号属性
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                this.id = value;
            }
        }

        //年龄属性
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                this.name = value;
            }
        }

        //性别属性
        public string Sex
        {
            get
            {
                return sex;
            }
            set
            {
                this.sex = value;
            }
        }

        //年龄属性
        public int Age
        {
            get
            {
                return age;
            }
            set
            {
                this.age = value;
            }
        }
    }

    //学生类
    public class Student
    {
        StuInfo info;            //学生信息
        StuScoreSem2 scores;     //学生成绩
        int sum;                 //总分
        int average;             //平均分

        //构造器
        public Student()
        { }

        //构造器
        public Student(StuInfo info, StuScoreSem2 scores)
        {
            this.info = info;
            this.scores = scores;
        }

        //学生信息属性
        public StuInfo Info
        {
            get
            {
                return info;
            }
            set
            {
                this.info = value;
            }
        }

        //学生成绩属性
        public StuScoreSem2 Scores
        {
            get
            {
                return scores;
            }
            set
            {
                this.scores = value;
            }
        }

        //总分属性
        public int Sum
        {
            get
            {
                return sum;
            }
            set
            {
                this.sum = value;
            }
        }

        //平均分属性
        public int Average
        {
            get
            {
                return average;
            }
            set
            {
                this.average = value;
            }
        }

        //计算总分
        public void ComputeSum()
        { }

        //计算平均分
        public void ComputeAverage()
        { }
    }

    public class Process
    {
        Student[] students;

        public Student[] Students
        {
            get
            {
                return students;
            }
            set
            {

                this.students = value;
            }
        }

        public Process(Student[] students)
        {
            this.students = students;
        }


        //按总分排序
        public void SortBySum()
        { }

        //按平均分排序
        public void SortByAverage()
        { }

        //按某科成绩排序
        public void SortBySubject(string subject)
        { }

        //按学生的某个信息进行查找,如果有返回该学生的信息,否则返回空
        public Student SearchByInfo(string info)
        { }

        //按总分输出学生信息
        public void OutputInfoBySum()
        { }

        //按平均分输出学生信息
        public void OutputInfoByAverage()
        { }

        //按学生的某科成绩输出学生信息
        public void OutputInfoBySubject(string subject)
        { }
    }

    class Program
    {
        static void Main(string[] args)
        {
            //创建学生信息数组和学生成绩数组
            stuInfo [] info = new stuInfo[50];
            stuScoreSem2 [] scores = new stuScoreSem2[50];
            Student[] student = new Student[50];
            int i = 0;
            int j = 0;
            
            //创建一个输入流进行读输入文件
            FileStream input = new FileStream("..//..//..//stuinfo.txt", FileMode.Open, FileAccess.Read);
            //创建一个输入字符流
            StreamReader reader = new StreamReader(input, Encoding.Default);

            //创建一个输出流和输出文件保存输出信息
           // FileStream output = new FileStream("..//..//..//stuoutput.txt", FileMode.Create,FileAccess.ReadWrite);

            //创建一个输出字符流
            //StreamWriter writer = new StreamWriter(output, Encoding.Default);

            reader.ReadLine();
            string str = reader.ReadLine();
            while(str != null)
            {
                string[] split = str.Split(new char[]{' ','\t'});
                info[i] = new stuInfo();
                scores[i] = new stuScoreSem2();

                foreach (string s in split)
                {
                    if (s != "" && s.Trim() != "")
                    {
                        switch(j)
                        {
                            case 0:
                                info[i].Id = Int32.Parse(s);
                                ++j;
                                break;
                            case 1:
                                info[i].Name = s;
                                ++j;
                                break;
                            case 2:
                                info[i].Sex = s;
                                ++j;
                                break;
                            case 3:
                                info[i].Age = Int32.Parse(s);
                                ++j;
                                break;
                            case 4:
                                scores[i].Eng = Int32.Parse(s);
                                ++j;
                                break;
                            case 5:
                                scores[i].Math = Int32.Parse(s);
                                ++j;
                                break;
                            case 6:
                                scores[i].Sport = Int32.Parse(s);
                                ++j;
                                break;
                            case 7:
                                scores[i].Datastucture = Int32.Parse(s);
                                ++j;
                                break;
                            case 8:
                                scores[i].OperatinSystem = Int32.Parse(s);
                                ++j;
                                break;
                            default:
                                break;

                        }
                    }
                }

                student[i] = new Student(info[i], scores[i]);

                j = 0;
                ++i;
                str = reader.ReadLine();
            }

            reader.Close();
            //writer.Close();
            input.Close();
            //output.Close();
        }
    }
}


--  作者:naive_1010
--  发布时间:3/4/2007 11:41:00 AM

--  
那你的需求是怎样的?
你还有哪些没有作到的?
你要具体罗列出来才好帮你的忙啊!
--  作者:蜾蠃赢羸螟蛉
--  发布时间:3/6/2007 12:22:00 AM

--  
就是要求能录入学生信息和成绩,能按某种形式排序输出(如:总分、单科),能查询(以学生的某种资料或是成绩),差不多就这些了,我QQ3215115,+我详谈,谢谢!
--  作者:蜾蠃赢羸螟蛉
--  发布时间:3/20/2007 4:22:00 PM

--  
呵呵,我已经把全部代码搞定了,有需要的联系我哈QQ3215115
--  作者:蜾蠃赢羸螟蛉
--  发布时间:10/23/2008 11:45:00 AM

--  
好久没来了,现在看看原来自己那个时候只是只菜鸟,呵呵
--  作者:topdreams
--  发布时间:11/3/2008 9:51:00 PM

--  
很难!
--  作者:蜾蠃赢羸螟蛉
--  发布时间:12/20/2009 7:21:00 PM

--  
各位小朋友,只要你是百度或者Google到这个帖子的应该都还是小学弟,这个也是我大一的时候期末交的作用,那个时候确实觉得挺难的,但是只要你善于翻书或者经常看MSDN或者逛CSDN应该还是不难写出来,这个代码我已近好不到了,所以呢,不用再加我QQ了,并且我现在不做编程,所以把该忘的不该忘的,全忘了,祝你好运,如果你正打算在这条路上走下去就去CSDN,如果只是想应付一下这个,那请你继续Google!
--  作者:蜾蠃赢羸螟蛉
--  发布时间:5/20/2011 5:16:00 PM

--  
各位小朋友,只要你是百度或者Google到这个帖子的应该都还是小学弟,这个也是我大一的时候期末交的作用,那个时候确实觉得挺难的,但是只要你善于翻书或者经常看MSDN或者逛CSDN应该还是不难写出来,这个代码我已近好不到了,所以呢,不用再加我QQ了,并且我现在不做编程,所以把该忘的不该忘的,全忘了,祝你好运,如果你正打算在这条路上走下去就去CSDN,如果只是想应付一下这个,那请你继续Google!

几年了,没想到我回来还是只是发一条这个不要加我QQ的评论,唉···CSDN和其他源码网站应该很多类似功能项目源码。


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
171.875ms