《2022年2022年工资管理系统源代码c》由会员分享,可在线阅读,更多相关《2022年2022年工资管理系统源代码c(24页珍藏版)》请在金锄头文库上搜索。
1、#include #include #include #include #include using namespace std; int i; class Person public: void display() cout name; cout num; while(num=0) cout? ? 0?y:num; string name;/? int num; ;/ ?class Teacher: public Person/? public: Teacher() int s=1000; wage = s; butie1=0; void display1(); int wage;/? in
2、t time; int butie1; int jintie1; ;/?void Teacher:display1() cout ?; Person:display(); cout time; while(time=0) cout? 0?y:time; class Leader: public Person/ ? public: Leader() int s=2500; int b=600; wage = s; butie = b; jintie=0; void display1() cout ? ?; Person:display(); int wage;/? int butie; int
3、jintie; ;/?class Jianzhi: public Teacher, public Leader/? ? public: Jianzhi( int b = 500) : Leader() butie = b; void display1() cout ? ?; Teacher:display(); cout time; while(time=0) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 24 页 - - - - - - - - - cout? 0?y
4、:time; int butie; ;/?Teacher t100; Leader x100; Jianzhi j100; void show() t? ? endl;t 1? ? endl;t 2? ? endl;t 3? ? ? endl;t 4? ? endl;cout ? ; void jiaoshiluru()/? ofstream outfile(?.txt, ios:app); if (!outfile) cerr open error! endl; exit(0); int b; cout b; for (i = 0; i b; i+) ti.display1(); cout?
5、 ?(y(Y)/n(N)c; if(c=Y|c=y) outfile ti.num ti.name ti.wage ti.time endl; outfile.close(); void Leaderluru()/ ?名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 24 页 - - - - - - - - - ofstream outfile( ?.txt, ios:app); if (!outfile) cerr open error! endl; exit(0); i
6、nt b; cout b; for (i = 0; i b; i+) xi.display1(); cout? ?(y(Y)/n(N)c; if(c=Y|c=y) outfile xi.num xi.name xi.wage xi.butie endl; void jianzhiluru()/? ? ofstream outfile(? ?.txt, ios:app); if (!outfile) cerr open error! endl; exit(0); int b; cout b; for (i = 0; i b; i+) ji.display1(); cout? ?(y(Y)/n(N
7、)c; if(c=Y|c=y) outfile ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.butie ji.Teacher:time c; if (c = 4) cout ? ? endl; system(cls); break; else switch (c) case 1: jiaoshiluru(); break; case 2: Leaderluru(); break; case 3: jianzhiluru(); break; default: cout ? ? endl; break; void jiaoshishuchu()
8、/? ifstream infile(?.txt, ios:in); int m; for (i = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; int jintie1; jintie1=ti.time*30; m = ti.wage + jintie1; t? ?: setw(8) ti.num setfill( )setw(10) ti.name setfill( )setw(10)ti.wage setfill( )setw(14)jintie1setfill( )setw(12)ti.butie1setfill
9、( )setw(10) m endl; infile.close(); void leadershuchu()/ ? ifstream infile( ?.txt, ios:in); int m; for (i = 0; i xi.num xi.name xi.wage xi.butie; if (xi.num = 0) break; m = xi.wage + xi.butie; cout t ? setfill( )setw(8)xi.num setfill( )setw(10) xi.name setfill( )setw(10)xi.wagesetfill( )setw(14)xi.j
10、intiesetfill( )setw(12)xi.butiesetfill( ) setw(10) m endl; infile.close(); void jianzhishuchu()/? ? ifstream infile(? ?.txt, ios:in); int m; for (i = 0; i ji.Teacher:num ji.Teacher:name 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 24 页 - - - - - - - - - ji.Le
11、ader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) break; int jintie1; jintie1=ti.time*30; m = ji.Leader:wage + ji.butie +jintie1 ; cout t? ? ? setfill( )setw(2) ji.Teacher:num setfill( )setw(10) ji.Teacher:namesetfill( )setw(10)ji.Leader:wagesetfill( )setw(14)jintie1setfill( )setw(12)ji.bu
12、tie setfill( )setw(10) m endl; void shuchu()/? t ? ? ? ? ? ? ? ? endl; jiaoshishuchu(); leadershuchu(); jianzhishuchu(); void show3() t? ? endl;t 1? ? endl;t 2? ? endl;t 3? ? ? endl;t 4? ? endl;cout x; switch(x) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 24
13、 页 - - - - - - - - - t? ?; cinnam; for (i = 0, n = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; if (ti.name=nam) n+; m = ti.wage + (ti.time - 24) * 30; t ? ? ?endl; cout t? ? ti.num ti.name m endl; if (n =0) cout ? num; for (i = 0, n = 0; i ti.num ti.name ti.wage ti.time; if (ti.num =
14、 0) break; if (ti.num=num) n+; m = ti.wage + (ti.time - 24) * 30; t ? ? ?endl; cout t? ? ti.num ti.name m endl; if (n =0) cout ? endl; infile.close(); break; default:cout? ? ?!y; switch(y) t? ? ?; cinnam; for (i = 0, n = 0; i xi.num xi.name xi.wage xi.butie; if (xi.num = 0) break; if (xi.name=nam) n
15、+; m = xi.wage + xi.butie; t ? ? ?endl;t ? xi.num xi.name m endl; if (n =0) cout ? ? num; for (i = 0, n = 0; i xi.num xi.name xi.wage xi.butie; if (xi.num = 0) break; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 24 页 - - - - - - - - - if (xi.num=num) n+; m =
16、xi.wage + xi.butie; t ? ? ?endl;t ? xi.num xi.name m endl; if (n =0) cout ? ? endl; infile.close(); break; default:cout? ? ?!x; switch(x) t? ? ?;cinnam; for (i = 0, n = 0; i ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) break; if (ji.Teacher:name=nam
17、) n+; m = ji.Leader:wage + ji.butie + ji.Teacher:time * 30; t ? ? ?endl;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 24 页 - - - - - - - - - cout ? ? ji.Teacher:num ji.Teacher:name m endl; if (n =0) cout ? ? num; for (i = 0, n = 0; i ji.Teacher:num ji.Teacher
18、:name ji.Leader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) break; if (ji.Teacher:num=num) n+; m = ji.Leader:wage + ji.butie + ji.Teacher:time * 30; t ? ? ?endl;cout ? ? ji.Teacher:num ji.Teacher:name m endl; if (n =0) cout ? ? endl; infile.close(); break; default:cout? ? ?! c; if (c = 4)
19、 cout ? ? endl; system(cls); break; ; else switch (c) case 1: jiaoshichaxun(); break; case 2: leaderxhaxun(); break; case 3: jianzhichaxun(); break; default: cout ? ? endl; break; void show5() t? ? endl;t 1? ? endl;t 2? ? ? endl;t 3? ? endl;cout ? ?;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - -
20、 - - - 名师精心整理 - - - - - - - 第 12 页,共 24 页 - - - - - - - - - void jiaoshixiugai()/? ifstream infile(?.txt, ios:in); string nam; int n, n1, m1 = 0; cout nam; cout n; for (i = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; m1+; if (ti.name =nam) n1 = ti.time; ti.time = n; n = n1; infile.cl
21、ose(); ofstream outfile(?.txt, ios:out); for (i = 0; i m1; i+) outfile ti.num ti.name ti.wage ti.time endl; outfile.close(); void janzhi2xiugai()/? ? ifstream infile(? ?.txt, ios:in); int n, n1, n2; string nam; cout nam; cout n2; for (i = 0, n = 0; i ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.
22、butie ji.Teacher:time; if (ji.Teacher:num = 0) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 24 页 - - - - - - - - - break; n+; if (ji.Teacher:name=nam) n1 = ji.Teacher:time; ji.Teacher:time = n2; n2 = n1; infile.close(); ofstream outfile(? ?.txt, ios:out); fo
23、r (i = 0; i n; i+) outfile ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.butie ji.Teacher:time c; if (c = 3) t ? ? endl; system(cls); break; else switch (c) case 1: jiaoshixiugai(); break; case 2: janzhi2xiugai(); break; default: cout ? ? endl; break; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - -
24、- - - - - - 名师精心整理 - - - - - - - 第 14 页,共 24 页 - - - - - - - - - void show6() t? ? ? endl;t1? ?y endl; t2? ?y endl;t3? ? ?y endl;t4? ?y endl;cout x; switch(x) t? ?y?;cinnam; for (i = 0, n = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; if (ti.name=nam) n+; ti.num=0;break; if (n =0) cou
25、t ?y? endl;else cout ?y? ?!num; for (i = 0, n = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; if (ti.num=num) n+; ti.num=0;break; if (n =0) cout ?y? endl;else cout ?y? ?endl; infile.close(); break; default:cout? ? ?! endl;break; infile.close(); ofstream outfile(?.txt, ios:out); for (i
26、= 0; i 100; i+) if (ti.num != 0) outfile ti.num ti.name ti.wage ti.time y; switch(y) t? ?y? ?;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 24 页 - - - - - - - - - cinnam; for (i = 0, n = 0; i xi.num xi.name xi.wage xi.butie; if (xi.num = 0) break; if (xi.name
27、=nam) n+; xi.num=0;break; if (n =0) cout ?y? ? endl;else cout ?y? ?num; for (i = 0, n = 0; i xi.num xi.name xi.wage xi.butie; if (xi.num = 0) break; if (xi.num=num) n+; xi.num=0;break; if (n =0) co ut ?y? ? endl;else cout ?y? ?endl; infile.close(); break; default:cout? ? ?!endl;break; infile.close()
28、; ofstream outfile( ?.txt, ios:out);名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 17 页,共 24 页 - - - - - - - - - for (i = 0; i 100; i+) if (xi.num != 0) outfile xi.num xi.name xi.wage xi.butie y; switch(y) t? ?y? ?;cinnam; for (i = 0, n = 0; i ji.Teacher:num ji.Teach
29、er:name ji.Leader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) break; if (ji.Teacher:name=nam) n+; ji.Teacher:num=0;break; if (n =0) cout ?y? ? endl;else cout ?y? ?num; for (i = 0, n = 0; i ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) brea
30、k; if (ji.Teacher:num=num) n+; ji.Teacher:num=0; break; if (n =0) cout ?y? ? endl;else cout ?y? ?endl; infile.close(); break; default:cout? ? ?! endl;break; infile.close(); ofstream outfile(? ?.txt, ios:out); for (i = 0; i 100; i+) if (ji.Teacher:num != 0) outfile ji.Teacher:num ji.Teacher:name ji.L
31、eader:wage ji.butie ji.Teacher:time c; if (c = 4) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 19 页,共 24 页 - - - - - - - - - cout ?y? ? endl; system(cls); break; else switch (c) case 1: jiaoshidel(); break; case 2: leaderdel(); break; case 3: jianzhidel(); break; d
32、efault: cout ? ? endl; break; void show_sort() cout ? ? endl;t 1? ? endl;t 2? ? ? endl;t 3? ? endl;cout ? ? ; void jiaoshi_sort() /? ifstream infile(?.txt, ios:in); int m100; for (i = 0; i ti.num ti.name ti.wage ti.time; if (ti.num = 0) break; mi = ti.wage + ti.time * 30; 名师资料总结 - - -精品资料欢迎下载 - - -
33、- - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 20 页,共 24 页 - - - - - - - - - infile.close(); int count = i; Teacher teacher; int tmp; for (int x = 0; x count - 1; +x) for (int y = x + 1; y count; +y) if (mx my) teacher = tx; tx = ty; ty = teacher; tmp = mx; mx = my; my = tmp; t ? ? ? endl; for
34、 (i = 0; i count; +i) cout t? ?: se tfill( )setw(6) ti.num setfill( )setw(10) ti.name setfill( )setw(10) mi endl; void jianzhi_sort() /? ? ifstream infile(? ?.txt, ios:in); int m100; for (i = 0; i ji.Teacher:num ji.Teacher:name ji.Leader:wage ji.butie ji.Teacher:time; if (ji.Teacher:num = 0) break;
35、mi = ji.Leader:wage + ji.butie + ji.Teacher:time * 30; infile.close(); int count = i; Jianzhi jz2; int tmp; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 21 页,共 24 页 - - - - - - - - - for (int x = 0; x count - 1; +x) for (int y = x + 1; y count; +y) if (mx my) jz2 =
36、 jx; jx = jy; jy = jz2; tmp = mx; mx = my; my = tmp; t ? ? ? endl; for (i = 0; i count; +i) cout t? ? ? setfill( )setw(6) ji.Teacher:num setfill( )setw(10) ji.Teacher:namesetfill( )setw(11) mi c; if (c = 3) cout ? ? endl; system(cls); break; else switch (c) case 1: jiaoshi_sort(); break; case 2: jia
37、nzhi_sort(); break; default: cout ? ? endl;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 22 页,共 24 页 - - - - - - - - - break; void show7() t ? ? ? endl;t1? ? ? endl;t2? ? endl;t3? ? endl;t4? ?y endl;t5? ? endl;t6? ? ? endl;t7? ? endl;cout c; if (c = 7) cout ? ? endl
38、; break; else switch (c) case 1: wenjianluru(); break; case 2: shuchu(); break; case 3: xiugai(); break; case 4: del(); break; case 5: wenjianchaxun(); break; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 23 页,共 24 页 - - - - - - - - - case 6: sort(); break; default: cout ? ? endl; break; return 0; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 24 页,共 24 页 - - - - - - - - -