1、教师课程管理系统c+课程设计源代码#include#include#include#include#include#includeusing namespace std;using std:string;class ke;ostream&operator(istream&sour,ke&k);class teacher;ostream&operator(istream&sour,teacher&t);class keprotected: static int keID; string keName; char keJB; int keXS; int keJC; int keBH;public:
2、 ke(string name=未命名的课程,char jb=0,int xs=0,int jc=0,int bh=0); void show(); friend ostream&operator(istream&sour,ke&k); int getkeJC()return keJC; string getkeName()return keName;int ke:keID=0;ke:ke(string name,char jb,int xs,int jc,int bh) keID+; bh=keID; keName=name; keJB=jb; keXS=xs; keJC=jc; keBH=
3、bh;void ke:show() cout课程编号: keBHendl; cout课程名称: keNameendl; cout课程级别: ; switch (keJB) case 1:cout公共基础课endl;break; case 2:cout专业基础课endl;break; case 3:cout专业课endl;break; case 4:cout公选课endl; cout学时: keXSendl; cout基本课酬: keJCendl;ostream&operator(ostream&dist,ke&k) distrightsetw(10)k.keBH; distleftsetw(2
4、0)k.keName; distrightsetw(10)k.keJBsetw(10)k.keXSsetw(10)k.keJC(istream&sour,ke&k) sourk.keBHk.keNamek.keJBk.keXSk.keJC; return sour;class keDB:public kepublic: int judge(); void add(); void del();void keDB:add() coutkeName; cout1)公共基础课 2)专业基础课 3)专业课 4)公选课endl; coutkeJB; while(keJB!=1&keJB!=2&keJB!=
5、3&keJB!=4) cout错了!让你输1、2、3、4你还输别的,专业点好不好=_=.endl; cout1)公共基础课 2)专业基础课 3)专业课 4)公选课endl; coutkeJB; coutkeXS; while(keXS=100) cout要么学时太多超出范围,要么你就输入了什么奇怪的东西,重新输!endl; coutkeXS; coutkeJC; while(keJC=100000) if(keJC=10000) cout这个价位也太高了吧,你确定不是在洗黑钱?endl; else if(keJC=0) cout给人上课还倒贴钱,脑子进水了吧=_=endl; coutkeJC;
6、 cout课程编号(自动生成):keBHendl;void keDB:del() keName=未命名的课程; keJB=0; keXS=0; keJC=0;int keDB:judge() return keJB;class teacherprotected: static int teachID; string teName; int teNo; string teClass; int teNumber; double teMoney; string kName; keDB k100;public: teacher(string kname=none,int no=0,string nam
7、e=none,string tclass=none,int number=0,int money=0) teachID+; kName=kname; teNo=teachID; teName=name; teClass=tclass; teNumber=number; teMoney=money; string getkeName()return teName; friend ostream&operator(istream&sour,teacher&t); void show() if(teName!=none) pay(); cout教师编号: teNoendl; cout教师姓名: te
8、Nameendl; cout课程名称: kNameendl; cout教授班级编号: teClassendl; cout教授班级数量: teNumberendl; cout课酬: teMoneyendl; else cout该老师不存在!endl; void pay() keDB k100; int i=0,n=0,m=0; ifstream ifile(D:课程数据.data); for(i=0;iki; ifile.close(); for(i=0;i100;i+) if(ki.getkeName()=kName) m=i; break; switch(km.judge() case 1:
9、if(teNumber=3) teMoney=km.getkeJC()*teNumber; else if(teNumber=6) teMoney=km.getkeJC()*teNumber*1.1; else teMoney=km.getkeJC()*teNumber*1.2; break; case 2:teMoney=km.getkeJC()*1.2*teNumber;break; case 3:teMoney=km.getkeJC()*1.2*teNumber;break; case 4:teMoney=km.getkeJC()*teNumber;break; ;int teacher
10、:teachID=0;ostream&operator(ostream&dist,teacher&t) distrightsetw(10)t.teNo; distleftsetw(20)t.teNamesetw(20)t.kNamesetw(60)t.teClass; distrightsetw(10)t.teNumbersetw(10)t.teMoney(istream&sour,teacher&t) sourt.teNot.teNamet.kNamet.teClasst.teNumbert.teMoney; return sour;class teacherDB:public teache
11、rpublic: int judge() return teNumber; void add() int i=0; string temp,a=、; coutteName; coutkName; coutteNumber; teClass=; cout请输入教师所教授班级的编号; for(i=0;itemp; teClass+=temp; teClass+=a; cout教师编号(自动生成):teNoendl; pay(); cout教师课酬(自动生成):teMoneyendl; void del() teName=none; kName=none; teClass=none; teNumbe
12、r=0; teMoney=0; ;int main() int i,c; char a,b=1,d,e; string str; keDB k100; teacherDB t100; cout endl; cout endl; cout C+ 真难 endl; cout endl; cout (_) (_) endl; cout endl; cout () endl; cout endl; cout endl; cout endl; cout 按任意键继续。; getch(); system(cls); cout *|endl; cout * *|endl; cout * 课程管理系统(最终版
13、) *|endl; cout * 机械科学与工程学院 *|endl; cout * 机制xxxx 班 *endl; cout * 组长:翟南 *endl; cout |* 组员:一路顺风、kucubfdietiy、鸩羽千夜 *endl; cout |* 指导老师:学会闲 *endl; cout |* *endl; cout |*endlendl; cout 按任意键继续。endl; getch(); system(cls); couta; if(a=n|a=N) ofstream ofile(D:课程数据.data); for(i=0;i100;i+) ofileki; ofile.close
14、(); else ifstream ifile(D:课程数据.data); for(i=0;iki; ifile.close(); couta; if(a=n|a=N) ofstream ofile1(D:教师数据.data); for(i=0;i100;i+) ofile1ti; ofile1.close(); else ifstream ifile1(D:教师数据.data); for(i=0;iti; ifile1.close(); system(cls); /完成数据初始化。 while(b!=0) cout *|endl; cout * *|endl; cout * 1) 添加信息
15、*|endl; cout * 2) 删除信息 *|endl; cout * 3) 修改信息 *endl; cout * 4) 显示信息 *endl; cout |* *endl; cout |* 0) 退出系统并全部保存 *endl; cout |* *endl; cout |*endlendl; coutb; system(cls); if(b=1) d=1; while(d!=0) cout *|endl; cout * *|endl; cout * 1) 添加课程信息 *|endl; cout * *|endl; cout * 2) 添加教师信息 *endl; cout * *endl;
16、 cout |* 0) 返回 *endl; cout |* *endl; cout |* *endl; cout |*endlendl; coutd; if(d=1) for(i=0;i100;i+) if(ki.judge()=0) ki.add(); ofstream ofile(D:课程数据.data); for(i=0;i100;i+) ofileki; ofile.close(); cout添加成功!endl; break; getch(); system(cls); continue; if(d=2) for(i=0;i100;i+) if(ti.judge()=0) ti.add
17、(); ofstream ofile1(D:教师数据.data); for(i=0;i100;i+) ofile1ti; ofile1.close(); cout添加成功!endl; break; getch(); system(cls); continue; if(d=0) system(cls); break; else coutMD让你输120你还输别的,搞毛线啊!重来!endl; getch(); system(cls); continue; continue; d=1; if(b=2) while(d!=0) cout *|endl; cout * *|endl; cout * 1)
18、 删除课程信息 *|endl; cout * *|endl; cout * 2) 删除教师信息 *endl; cout * *endl; cout |* 0) 返回 *endl; cout |* *endl; cout |* *endl; cout |*endlendl; coutd; if(d=1) for(i=0;i100;i+) if(ki.judge()!=0) ki.show();coutendl; coutc; if(kc-1.judge()!=0) kc-1.del(); ofstream ofile(D:课程数据.data); for(i=0;i100;i+) ofileki;
19、 ofile.close(); cout删除成功!endl; else cout这课早就删了,删了又删,删了还删,你不无聊我都觉得无聊=_=endl; getch(); system(cls); continue; if(d=2) for(i=0;i100;i+) if(ti.getkeName()!=none) ti.show();coutendl; coutc; tc-1.del(); ofstream ofile1(D:教师数据.data); for(i=0;i100;i+) ofile1ti; ofile1.close(); cout删除成功!endl; getch(); system(cls); continue; if(d=0) system(cls); break; else cout MD让你输120你还输别的,搞毛线啊!重来!endl; getch(); system(cls); continue; continue; d=1; if(b=3) while(d!=0) cout *
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1