设计题目 |
班级成绩管理系统 |
已知技术参数和设计要求 |
对一个有N个学生的班级,每个学生有M门课程。该系统实现对班级成绩的录入、显示、修改、排序等操作的管理。 班级信息,课程信息,学生信息自定义。 |
设计内容与步骤 |
1、 模块化程序设计。 2、 具体数据结构的定义及其处理数据算法的设计。 3、 锯齿型程序书写格式 4、 程序设计、实现、调试。 5、 课程设计说明书。 |
设计工作计划与进度安排 |
1、 程序设计10学时。 2、 实现与调试6学时。 3、 课程设计说明书4学时。 |
设计考核要求 |
1、 考勤20%。 2、 课程设计说明书30%。 3、 答辩、成果演示50%。 |
#include<iostream>
#include<string>#include<cstring>
#include<algorithm>
#include<iterator>
#include <iomanip>
using namespace std;
class Student
{
public:
friend istream& operator>>(istream&, Student&);
friend ostream& operator<<(ostream&, const Student&);
Student(){}
Student(int id, char sName[], float m, float e, float c, float cn, float sum);
friend bool operator > (const Student&, const Student&);
int ID;//学号
char stuName[20];
float chinese, math, english, cjia;
float sum;//总数
};
Student::Student(int id, char sName[], float m, float c,float e, float cn,float sum):ID(id), chinese(c), math(m),
english(e), cjia(cn)
{
sum = c+m + e + cn;
strcpy(stuName, sName);//字符串复制函数
}
bool operator > (const Student &stu1, const Student &stu2)//重载>运算符
{
return stu1.sum > stu2.sum;
}
istream& operator>>(istream &is, Student &stu)
{
cout << "学生的学号为:"; is >> stu.ID;
cout << "学生的姓名为:"; is >> stu.stuName;
cout << "学生的语文成绩为:"; is >> stu.chinese;
cout << "学生的数学成绩为:"; is >> stu.math;
cout << "学生的英语成绩为:"; is >> stu.english;
cout << "学生的C++成绩为:"; is >> stu.cjia;
stu.sum =stu.chinese+ stu.math + stu.english + stu.cjia;
return is;
}
ostream& operator<<(ostream &os, const Student &stu)
{
os << stu.stuName << "的信息为:" << endl;
os << "学号:" << stu.ID << endl;
os << "语文成绩:" << stu.chinese << endl;
os << "数学成绩:" << stu.math << endl;
os << "英语成绩:" << stu.english << endl;
os << "C++成绩:" << stu.cjia << endl;
os << "总分:" << stu.sum << endl;
return os;
}
void add(Student s[], int i);//添加学生信息
void show(Student s[], int i);//显示学生信息
void change(Student s[], int i, int id);//修改学生信息
void del(Student s[], int i, int id);//删除学生信息
void paixu(Student s[], int i);//排序函数
void search(Student s[], int i, int id);//查找函数
int main()
{