久久99精品久久久久久琪琪,久久人人爽人人爽人人片亞洲,熟妇人妻无码中文字幕,亚洲精品无码久久久久久久

簡單學生信息管理系統(tǒng)C++范文

時間:2019-05-13 18:14:48下載本文作者:會員上傳
簡介:寫寫幫文庫小編為你整理了多篇相關的《簡單學生信息管理系統(tǒng)C++范文》,但愿對你工作學習有幫助,當然你在寫寫幫文庫還可以找到更多《簡單學生信息管理系統(tǒng)C++范文》。

第一篇:簡單學生信息管理系統(tǒng)C++范文

#include

#include

using namespace std;

int i=0;

void layout()

{

cout<<“歡迎使用學生信息系統(tǒng)”<

cout<<“請選擇功能序號:”<

cout<<“0.輸入學生信息”<

cout<<“1.計算平均分并排序”<

cout<<“2.統(tǒng)計學科平均分”<

cout<<“3.統(tǒng)計班級平均分”<

cout<<“4.按學號修改學生信息”<

cout<<“5.根據(jù)學號查詢學生信息”<

cout<<“---------萬惡的分割線----------”<

}

class student

{

private:

int num;

string name;

double score1,score2;

public:

double c;

int banji;

string sex;

student(){}

void set_student(int bj,int n,string nam,string s,double les1,double les2){

banji=bj;

num=n;

name=nam;

sex=s;

score1=les1;

score2=les2;

}

int get_score1()

{

return score1;

}

int get_score2()

{

return score2;

}

int get_num()

{

return num;

}

void show()

{

c=(score1+score2)/2;

cout<

}

}stu[20];

void show_1()

{

cout<<“班級:t學號t姓名t性別t學科一t學科二t平均分”<

}

//學生信息輸入//

void INPUT()

{

int j=0;

int x;

do{int banji;int num;string name;string sex;double score1,score2;

cout<<“請輸入學生信息:”<

cout<<“班級:t”<<“學號:t”<<“姓名:t”<<“性別:t”<<“學科一:t”<<“學科二:t”<

cin>>banji>>num>>name>>sex>>score1>>score2;

stu[i].set_student(banji,num,name,sex,score1,score2);

i++;

cout<<“是否繼續(xù)輸入學生信息?是:請輸入0/否:請輸入1”<

cin>>x;

}while(x==0);

show_1();

for(j=0;j

{

stu[j].show();

}

}

//計算平均分并排序//

void Paixu()

{student stu1;

for(p=0;p<=i-1;p++)

{

k=p;

for(j=p+1;j

if(stu[j].c

{k=j;

stu1=stu[k];stu[k]=stu[p];stu[p]=stu1;

}

}

show_1();

for(j=0;j

{

stu[j].show();

}

}

//統(tǒng)計學科平均分//

void xueke()

{

double q1;

double sum1;

int p1;

for(p1=0;p1<=i;p1++)

{

sum1=sum1+stu[p1].get_score1();

}

q1=sum1/i;

cout<<“學科一平均成績:”<

double q2;

double sum2;

int p2;

for(p2=0;p2<=i;p2++)

{

sum2=sum2+stu[p2].get_score2();

}

q2=sum2/i;

cout<<“學科二平均成績:”<

}

//統(tǒng)計班級平均分//

void banji()

double q1,q2;

double sum1,sum2;

int p,m;

m=0;

sum1=0;sum2=0;

for(p=0;p<=i;p++)

{

a[p]=stu[p].banji;

}

for(m=0;m<=i;m++)

{int t=1;

sum1=stu[m].get_score1();

sum2=stu[m].get_score2();

for(p=m+1;p<=i;p++)

{

if((a[m]==a[p])&&a[p]!=0)

{

sum1=sum1+stu[p].get_score1();

sum2=sum2+stu[p].get_score2();

a[p]=0;

t++;

}

}

if(a[m]!=0){

q1=sum1/t;

q2=sum2/t;

cout<<“電信”<

cout<<“學科二平均成績:”<

}

}

}

//按學號查詢學生信息//

void chaxun()

{int x;

cout<<“請輸入學號:”;

cin>>x;

int p;

for(p=0;p<=i;p++)

{

if(x==stu[p].get_num())

{

show_1();

stu[p].show();

}

}

}

//按學號修改學生信息//

void xiugai()

{

int j;

int x;

cout<<“請輸入需修改學號:”;

cin>>x;

int p;

for(p=0;p<=i;p++)

{

if(x==stu[p].get_num())

{

int banji;int num;string name;string sex;double score1,score2;

cout<<“請輸入學生信息:”<

cout<<“班級:t”<<“學號:t”<<“姓名:t”<<“性別:t”<<“學科一:t”<<“學科二:t”<

cin>>banji>>num>>name>>sex>>score1>>score2;

stu[p].set_student(banji,num,name,sex,score1,score2);

show_1();

for(j=0;j

{

stu[j].show();

}

}

}

}

int main()

{layout();

int flag;

int n;

for(n=0;n<=100;n++)

{

cin>>flag;

switch(flag){

case 0:

cout<<“輸入范例:”;

cout<<“班級:t”<<“學號:t”<<“姓名:t”<<“性別:t”<<“學科一:t”<<“學科二:t”<

cout<<“1 1109 朱偉 男 100 98”<

cout<<“---------萬惡的分割線----------”<

INPUT();

break;

case 1:

Paixu();

break;

case 2:

xueke();

break;

case 3:

banji();

break;

case 4:

chaxun();

break;

case 5:

xiugai();

break;

case 6:

n=100;

}cout<<“再見!謝謝使用本系統(tǒng)!”;break;default:cout<<“請重新輸入功能序號:”;break;}}

第二篇:C++課程設計學生信息管理系統(tǒng)

C++程序設計實踐教學環(huán)節(jié)任務書

一、題目:學生信息管理系統(tǒng)

二、目的與要求

1.目的:

(1)掌握面向對象程序設計的基本思路和方法;

(2)了解系統(tǒng)開發(fā)的需求分析、類層次設計、模塊分解、編碼測試、模塊

組裝與整體調試的全過程;

(3)進一步熟悉C++中類的概念、類的封裝、繼承的實現(xiàn)方式;(4)學會分析簡單的實際問題,并能利用所學的知識建立系統(tǒng)的邏輯結構,學會簡單的調試技巧和方法。逐步熟悉面向對象程序設計的方法,養(yǎng)成良好的編程習慣。

2.要求基本要求:

(1)要求利用C++面向對象的編程思想來完成系統(tǒng)的設計;(2)進行簡單界面設計,能夠實現(xiàn)友好的交互;(3)具有清晰的程序流程圖和數(shù)據(jù)結構的詳細定義;(4)熟練掌握C++對文件的各種操作。

三、信息描述

有關該系統(tǒng)基本信息的描述(如:學號、姓名、系別、班級和各科成績等)。

四、功能描述

1.添加、刪除

系統(tǒng)將提示用戶輸入新添加學生的信息;由用戶輸入要刪除的學生的學號,然后調用刪除函數(shù),刪除該名學生的資料。2.查找

首先由用戶輸入要查找的學生的學號,系統(tǒng)用查找函數(shù)查找,然后系統(tǒng)就調用輸出函數(shù)。

3.修改

首先由用戶輸入要修改的學生的學號,然后系統(tǒng)用修改函數(shù)查找,顯示該名學生的資料,然后系統(tǒng)提示用戶輸入需要修改的項目和新的資料。4.界面要求

開始登錄管理界面、主要提示菜單界面(提示用戶執(zhí)行何種操作)等。

五、解決方案

1.分析程序的功能要求,劃分程序功能模塊。2.畫出系統(tǒng)流程圖。

3.代碼的編寫、程序的功能調試。4.完成系統(tǒng)總結報告以及使用說明書

六、進度安排

此次課程設計時間為一周或兩周,分四個階段完成:

1.分析設計階段。指導教師應積極引導學生自主學習和鉆研問題,明確

設計要求,找出實現(xiàn)方法,按照需求分析、總體設計、詳細設計這幾個步驟進行。

2.編碼調試階段:根據(jù)設計分析方案編寫代碼,然后調試該代碼,實現(xiàn)

課題要求的功能。

3.總結報告階段:總結設計工作,寫出課程設計說明書,要求學生寫出需

求分析、總體設計、詳細設計、編碼、測試的步驟和內容。4.考核階段。

七、撰寫課程設計報告或課程設計總結

總結報告包括需求分析、總體設計、詳細設計、編碼(詳細寫出編程步驟)、測試的步驟和內容、課程設計總結、參考資料等,不符合以上要求者,則本次設計以不及格記。

八、參考資料

《C++語言程序設計教程》

網(wǎng)上相關資料(....略)

第三篇:c++學校人員信息管理系統(tǒng)

1.C++課程設計題目:《學校人員信息管理系統(tǒng)》

用c++設計一個大學教師和學生管理程序,教師包括編號(a),姓名(c),職稱(d)和教研室數(shù)據(jù)(b)的數(shù)據(jù)輸入輸出;大學生包括編號(m),姓名(s),性別(t),班號(n),英語(e),高等數(shù)學(f)和數(shù)據(jù)結構(g)三門課程成績輸入輸出和計算機平均分(ave);研究生包括編號,姓名,性別,班號,指導教師和研究方法數(shù)據(jù)輸入輸出;博士后數(shù)據(jù)的輸入輸出;博士后既是教師也是研究生.(用派生,繼承的方法可以做)2.功能如下圖所示:

學生成績管理系統(tǒng)主函數(shù)主菜單錄入學生信息保存信息到文件瀏覽學生信息按姓名或學號查詢信息刪除信息退出系統(tǒng) 3.部分代碼 #include #include #include“persons.h” #include“student.h” #include“teacher.h” #include“empoyee.h” #include“chainList.h” #include void fileRead(chainList *list,ifstream &ff);//把文件從硬盤上讀入內存 void fileWrite(chainList *list,ofstream &ff);//寫入硬盤

int compareStr(char*str1,char*str2);//名字作為關鍵字,這個函數(shù)就用來比較 void addList(chainList *list);//同名的話,覆蓋,或者改為新名字加入 void

deleteNode(chainList *node);//根據(jù)名字刪除

void editList(chainList *list,char *name);//要編輯的人名和新的資料

chainList *searchList(chainList *list,char*name);//只提供名字查詢(其他以后加入)//返回前一個節(jié)點的指針

void orderList(chainList *list);//按名字排序

void orderListByAge(chainList *list);//按年齡降序排列

void orderListBySex(chainList *list);//按照性別排列,女士優(yōu)先 void printStaticInfo(chainList*list);void printList(chainList *list);int main(){cout<<“tYou are welcome to the management system!”<>sn;char fileName[30];chainList headNode(0,NULL);chainList *head=&headNode;if(sn=='l'){ifstream file;

cout<<“File's name:”<

cin>>fileName;

file.open(fileName);if(!file)//為何輸入不存在地文件后,機子變得很慢,而且沒有結果出來?

{cout<<“File not found!System exit.”<

return 1;

}

// cout<<“test”<

fileRead(head,file);//讀入文件到鏈表

file.close();} printStaticInfo(head);char ctn;

do {cout<<“main menu:”<>ctn;switch(ctn){ case '0':break;case '1':

addList(head);

break;case '2':

cout<<“Please input the person's name to be deleted:”<

char nm[20];

cin>>nm;

chainList *pdel;

pdel=searchList(head,nm);

char sure;//Make sure whether you want to delete the data

sure='n';

if(!pdel->next)

{

cout<<“The person you input cann't be found”<

}

else{

cout<<“The persons infor follows:”<

pdel->next->pl->print();

cout<<“Are you sure to delete it?Press y or n”<

cin>>sure;

if(sure=='y')

{

deleteNode(pdel);

cout<

} } break;case '3': cout<<“Please input the person's name:”<>nm1;chainList *pp;

pp=searchList(head,nm1);

if(pp->next)

{

cout<<“The person's infor follows:”<

pp->next->pl->print();

cout<<“Now ,please edit the infors.”<

editList(head,nm1);

}

else

cout<<“The person can't be found!”<

break;

case '4':

cout<<“Please input the person's name:”<

char name[30];

cin>>name;

chainList *p;

p=searchList(head,name);

if(p->next)

{

p->next->pl->print();

}

else

cout<<“The person can't be found!”<

break;

case '5':

cout<<“You want to order the list by:”<

cout<<“1.name 2.age

3.sex(lady first)”<

char ch;

cin>>ch;

switch(ch)

{

case '1':

cout<<“You choose to order the list by name.The result are as follows:”<

orderList(head);

printStaticInfo(head);

break;

case '2':

cout<<“You choose to order the list by age.The result are as follows:”<

orderListByAge(head);

printStaticInfo(head);

break;

case '3':

cout<<“You choose to order the list by sex.The result are as follows:”<

orderListBySex(head);

printStaticInfo(head);

break;

default:

cout<<“Wrong choice!”<

}

break;

case '6':

printStaticInfo(head);

break;

default:

cout<<“Wrong choice!”<

}

}while(ctn!='0');cout<<“Do you want to save the file?No,press n.Else,any other key.”<>save;if(save!='n'){

cout<<“Please input the file's name:”<

cin>>fileName;

ofstream fin;

fin.open(fileName);//如果文件已經存在,詢問是否覆蓋。如何知道是否存在 if(!fin)

{

cout<<“Can't open output file.n”;

return 1;

}

fileWrite(head,fin);

fin.close();

cout<<“File has been successfully saved!”<

void fileRead(chainList *list,ifstream &ff){ chainList*p=list;int tp;

} char nm[20];int ag;char sx;int slr;int grd;

int e;int m;int g;int average;char schl[20];char sb[20];int teaYear;int aa=1;persons*psn;//插入人員指針

ff>>tp;while(tp){ ff>>ag;

ff>>nm;

ff>>sx;

switch(tp){

case 1: ff>>grd;ff>>schl;

psn=new student(ag,nm,sx,grd,schl,e,m,g,average);

break;case 2:

ff>>sb;

ff>>teaYear;

psn=new teacher(ag,nm,sx,sb,teaYear);

break;case 3:

ff>>slr;

psn=new empoyee(ag,nm,sx,slr);

break;}

} chainList*s=new chainList(tp,psn);p->next=s;p=s;ff>>tp;void fileWrite(chainList *list,ofstream &ff){ chainList*p=list->next;while(p){

ff<

typeOfPn<<“ ”<

pl->age<<“ ”<

pl->name<<“ ”<

pl->sex<<“ ”;

switch(p->typeOfPn)

{

case 1:

ff<<((student*)p->pl)->grade<<“ ”<<((student*)p->pl)->school<

break;

case 2:

ff<<((teacher*)p->pl)->subject<<“ ”<<((teacher*)p->pl)->yearsOfT<

break;

case 3:

ff<<((empoyee*)p->pl)->salary<

break;

} p=p->next;} int aa=0;ff<

int i=0;while((p1[i]==p2[i])&&p1[i]&&p2[i])

i++;if(p1[i]==p2[i]){

return 0;} else { if(p1[i]>p2[i])

return 1;

else

return-1;} }

void addList(chainList *list)//添加節(jié)點 {

char tp;int type;do{ cout<<“The person whose info you want to input is:”<

2.a teacher 3.a common employee”<>tp;//為什么一輸入字符就死循環(huán)??

char nm[20];int ag;char sx;int slr;int grd;char schl[20];

int e;int m;

int g;int average;char sb[20];int teaYear;int aa=1;persons*psn;//插入人員指針

switch(tp){ case '0':aa=0;

type=0;

break;case '1':

type=1;

cout<<“name:”<

cin>>nm;

cout<<“age:”<

cin>>ag;

cout<<“male or female?m or f?”<

cin>>sx;

cout<<“The student's grade”<

cin>>grd;

cout<<“From which school:”<

cin>>schl;

cout<<“the score of english:”<

cin>>e;

cout<<“the score of math:”<

cin>>m;

cout<<“the score of sjjg:”<

cin>>g;

cout<<“average:”<

psn=new student(ag,nm,sx,grd,schl,e,m,g,average);

break;

case '2':type=2;

cout<<“name:”<

cin>>nm;

cout<<“age:”<

cin>>ag;

cout<<“male or female?m or f?”<

cin>>sx;

cout<<“subject field:”<

cin>>sb;

cout<<“Years as a teacher:”<

cin>>teaYear;

psn=new teacher(ag,nm,sx,sb,teaYear);

break;

case '3':type=3;

cout<<“name:”<

cin>>nm;

cout<<“age:”<

cin>>ag;

cout<<“male or female?m or f?”<

cin>>sx;

cout<<“The employee's salary:”<

cin>>slr;

psn=new empoyee(ag,nm,sx,slr);

break;

default:type=6;

aa=0;

cout<<“Wrong choice!”<

}

chainList*p=list;//新節(jié)點在p所指的節(jié)點之前插入,if(aa)

{

int com;

if(p->next)

{

com=compareStr(nm,p->next->pl->name);

cout<

}

while(p->next&&com>0)//比p節(jié)點小或者p為空退出

{

p=p->next;

if(p->next)

com=compareStr(nm,p->next->pl->name);

}

chainList *s=new chainList(type,psn);

s->next=p->next;

p->next=s;

}

}while(type);

} void deleteNode(chainList *node){

chainList*ptemp=node->next;

node->next=ptemp->next;

delete ptemp;} void editList(chainList *list,char *name)//刪除,添加就是編輯。缺點:不想刪除的也被刪除了。{ chainList *pde;pde=searchList(list,name);

char tp;int type;do{

cout<<“The person whose info you want to input is:”<

cout<<“1.a student

2.a teacher 3.a common employee”<

cout<<“0.Return to main menu.”<

cin>>tp;//為什么一輸入字符就死循環(huán)??

char nm[20];

int ag;

char sx;

int slr;

int grd;

char schl[20];

int e;

int m;

int g;

int average;

char sb[20];

int teaYear;

int aa=1;

persons*psn;//插入人員指針

if(tp==1||tp==2||tp==3)

deleteNode(pde);switch(tp){ case '0':aa=0;type=0;break;case '1': type=1;cout<<“name:”<>nm;cout<<“age:”<>ag;cout<<“male or female?m or f?”<>sx;cout<<“The student's grade”<>grd;cout<<“From which school:”<>schl;cout<<“the score of english:”<>e;cout<<“the score of math:”<>m;cout<<“the score of sjjg:”<>g;psn=new student(ag,nm,sx,grd,schl,e,m,g,average);break;case '2':type=2;cout<<“name:”<>nm;cout<<“age:”<>ag;cout<<“male or female?m or f?”<>sx;cout<<“subject field:”<>sb;cout<<“Years as a teacher:”<>teaYear;psn=new teacher(ag,nm,sx,sb,teaYear);break;case '3':type=3;cout<<“name:”<>nm;

cout<<“age:”<

cin>>ag;

cout<<“male or female?m or f?”<

cin>>sx;

cout<<“The employee's salary:”<

cin>>slr;

psn=new empoyee(ag,nm,sx,slr);

break;

default:type=6;

aa=0;

cout<<“Wrong choice!”<

}

chainList*p=list;//新節(jié)點在p所指的節(jié)點之前插入,if(aa)

{

int com;

if(p->next)

{

com=compareStr(nm,p->next->pl->name);

cout<

}

while(p->next&&com>0)//比p節(jié)點小或者p為空退出

{

p=p->next;

if(p->next)

com=compareStr(nm,p->next->pl->name);

}

chainList *s=new chainList(type,psn);

s->next=p->next;

p->next=s;

}

}while(type);

} chainList *searchList(chainList *list,char*name)//查找函數(shù) { chainList *p=list;int com;if(p->next)

com=compareStr(name,p->next->pl->name);

while(p->next&&com)//com為0值(即名字相同)或者p->next為空退出

{ p=p->next;if(p->next)com=compareStr(name,p->next->pl->name);} return p;} void orderList(chainList *list){ chainList *p,*q;p=list;q=p->next;while(q->next&&p){

while((p->next!=q->next)&&p->next)//如果相等,則什么也不做

{

int i=compareStr(q->next->pl->name,p->next->pl->name);

i=-i;

if(i>0)//字母順序小的插在前面

{

chainList*s;

s=q->next;

q->next=s->next;

s->next=p->next;

p->next=s;

p=s;

break;

}

if(i==0)//字母順序相同的插到后面

{

chainList*ss;

ss=q->next;

q->next=ss->next;

p=p->next;//讓p永遠指向插入位置前一個位置。

ss->next=p->next;

p->next=ss;

p=ss;

break;

}

p=p->next;

}

p=list;//讓p重新指向頭節(jié)點。

if(q->next)

q=q->next;//q前進一步。

} }

void orderListByAge(chainList *list){ chainList*p,*q;p=list;q=p->next;while(q->next&&p){

while(p->next!=q->next)//如果相等,則什么也不做

{

int i=q->next->pl->age-p->next->pl->age;

if(i>0)//年齡大的插到用于比較的節(jié)點前面

{

chainList*s;

s=q->next;

q->next=s->next;

s->next=p->next;

p->next=s;

p=s;

break;

}

if(i==0)//年齡相同的插到后面

{

chainList*ss;

ss=q->next;

q->next=ss->next;

p=p->next;//讓p永遠指向插入位置前一個位置。

ss->next=p->next;

p->next=ss;

p=ss;

break;

}

p=p->next;

}

p=list;//讓p重新指向頭節(jié)點。

if(q->next)

q=q->next;//q前進一步。

} } void orderListBySex(chainList *list)//按性別排序,插入排序 { chainList*p,*q;p=q=list;

while(q->next){

if(q->next->pl->sex=='f')

{

chainList*s;

s=q->next;

q->next=s->next;//刪除,然后插到前面

s->next=p->next;

p->next=s;

p=s;

}

q=q->next;} }

void printStaticInfo(chainList*list){ int count,countS,countT,countE,countMale,countFemale;count=countS=countT=countE=countMale=countFemale=0;chainList*p=list->next;while(p){

p->pl->print();

count++;

if(p->pl->sex=='m')

countMale++;

else

countFemale++;

switch(p->typeOfPn)

{

case 1:

countS++;

break;

} case 2:

countT++;

break;case 3:

countE++;

break;} p=p->next;

} cout<<“********************************************”<

部分截圖

1.信息的輸入

2.瀏覽學生信息

開始N開始YNY輸出所有信息返回主菜單錄入信息保存信息返回主菜單打開文件文件中有無信息結束3.按姓名或學號查詢信息

4.刪除信息

開始NY輸入姓名或學號開始NY輸入姓名或學號N

打開文件打開文件Y輸出信息(name==sign)||(number==sign))Y刪除信息(name==sign)||(number==sign))N返回主菜單返回主菜單

心得體會:

通過本次課程設計懂得了,學習計算機語言知識,要不斷實踐,不斷學習新的內容,特別是課堂中沒有涉及的內容要自主的去學習并學會運用。在今后的學習中我要加強自主學習的能力,加強動手能力。通過一星期的C++語言程序設計課程設計,我們從中受益匪淺,并且對C++語言程序設計這一門課程有了更深一步的認識。在實習中,我們可以把這學期所學的理論知識和實踐聯(lián)系起來,在所要開發(fā)的項目中漸漸成長。雖然我們對這些C++語言知識運用得還不是很熟練,但是相信我們也在滴水穿石地成長起來。發(fā)現(xiàn)問題,提出問題,解決問題使我們從不足之處出發(fā),尋找新的方向。在課程設計中,我設計了一個學生信息管理系統(tǒng),它基本足了界面友好,易于操作的要求,因此更利于用戶操作方便,運行簡易,從而達到對人員管理更加有效系統(tǒng)的管理,并且速度更快內容更直接地達到用戶所想要的效果。在該軟件中我們實現(xiàn)了對學生信息的輸入和存取、讀取,對學生相關信息的刪除等,并且可以按學號查詢學生的相關信息等的功能。但軟件中仍然存在一些不足,例如在輸入有關學生的數(shù)據(jù)時名字沒有限定,插入新的學生信息的程序還有待完善,菜單不美觀等。我一邊設計一邊探索,發(fā)現(xiàn)理論和實踐要充分地結合,是需要扎實的基本功的,這就表明學好基礎知識是理論付諸實踐的前提。在實習中我們學到了很多,希望在以后我們能充分利用這樣的機會充實自己,并希望這樣的機會能被更好更多地提供。

第四篇:C++課程設計 教職工信息管理系統(tǒng)源代碼

教職工信息管理系統(tǒng)源碼

#include #include #include #include

#define maxsize 100 fstream iofile;//文件指針

class Time //時間類 {

public:

int year;

int month;

int day;};

class Telem //個人信息 {

public:

char name[20];

char sex[10];

Time birthtime;//組合Time類

char num[20];

char wage[20];

Time worktime;

int year;

char department[20];

friend istream& operator>>(istream& input,Telem& T);

friend ostream& operator<<(ostream& output,Telem& T);

friend int operator-(Time & t1,Time & t2);};

class People:virtual public Telem //雇員類 {

public:

People();

virtual void AddF()=0;//添加

virtual void Addall()=0;

virtual void Add()=0;

virtual void Display();//輸出數(shù)組的內容

virtual void Displaypart(char p[]);

virtual void Findname(char n[]);

virtual void Findyear(int);

virtual void Del(char n[])=0;

virtual void Del(int);protected:

Telem data[maxsize];

Time now;

int length;};

class Teacher:virtual public People //派生虛基類 {

public:

virtual void AddF();

virtual void Addall();

virtual void Add();

virtual void Display();

virtual void Del(int i);

virtual void Del(char n[]);};

class worker:virtual public People //派生虛基類 {

public:

virtual void AddF();

virtual void Addall();

virtual void Add();

virtual void Display();

virtual void Del(int i);

virtual void Del(char n[]);};

People::People()//系統(tǒng)自動生成的構造函數(shù) {

length=0;

now.year=2010;

now.month=7;

now.day=6;}

void People::Display()//引用 {

int i;

for(i=0;i

cout<

void People::Displaypart(char p[])//引用數(shù)組

{

int i,c;

for(i=0;i

if(strcmp(data[i].wage,p)==0)

{

cout<<“輸出選擇姓名1 性別2 編號3 工資4 出生日期5 工作時間6 年齡7 系別8 退出選擇9”<

while(cin>>c)

{

switch(c)

{

case 1: cout<<“姓名:”<

case 2: cout<<“性別:”<

case 3: cout<<“編號:”<

case 4: cout<<“工資:”<

case 5: cout<<“出生日期:”<

case 6: cout<<“工作時間:”<

case 7: cout<<“年齡:”<

case 8: cout<<“系別:”<

case 9: goto loop;

default:cout<<“操作錯誤......”<

}

}

loop:;

} }

void People::Findname(char n[])//引用 {

int i;

for(i=0;i

if(strcmp(data[i].name,n)==0)//對象引用

cout<

void People::Findyear(int y){

int i;

for(i=0;i

if(data[i].year==y)

cout<

void People::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;}

void worker::AddF(){

int flag=0;

iofile.open(“worker_information.txt”,ios::in|ios::binary);//文件的打開與關閉

while(iofile.seekg(ios::cur))

{

iofile.seekg(length*sizeof(data[length]),ios::beg);

iofile.read((char*)&data[length],sizeof(data[length]));//文件的隨機訪問

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

}

People::Del(length);

cout<<“添加人員信息成功......”<

loop:

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void worker::Addall(){

char ans;

int flag=0;

iofile.open(“worker_information.txt”,ios::out|ios::binary);

do

{

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人員信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void worker::Add(){

int flag=0;

iofile.open(“worker_information.txt”,ios::app|ios::out|ios::binary);

if(length==maxsize)

{

flag=1;

goto loop;

}

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人員信息成功......”<

length++;

loop:

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void worker::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“無......”<

int i;

for(i=0;i

cout<

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0){

k=i+1;break;}

if(k<1)

cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“刪除人員信息成功......”<

void worker::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“刪除成功......”<

}

void Teacher::AddF(){

int flag=0;

iofile.open(“Teacher_information.txt”,ios::in|ios::binary);

while(iofile.seekg(sizeof(data[length]),ios::cur))

{

if(iofile.seekg(length*sizeof(data[length]),ios::beg))

iofile.read((char*)&data[length],sizeof(data[length]));

else

break;

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

}

People::Del(length);

cout<<“添加人員信息成功......”<

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void Teacher::Addall(){

char ans;

int flag=0;

iofile.open(“Teacher_information.txt”,ios::in|ios::out|ios::binary);

do

{

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人員信息成功......”<

length++;

if(length==maxsize)

{

flag=1;

goto loop;

}

cout<<“contine(Y|N)?”;

cin>>ans;

}while('y'==ans||'Y'==ans);loop:

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void Teacher::Add(){

int flag=0;

iofile.open(“Teacher_information.txt”,ios::app|ios::out|ios::binary);

if(length==maxsize)

{

flag=1;

goto loop;

}

cin>>data[length];

data[length].year=now-data[length].birthtime;

iofile.write((char*)&data[length],sizeof(data[length]));

cout<<“添加人員信息成功......”<

length++;loop:

if(1==flag)

cout<<“人員信息儲存空間已滿......”<

iofile.close();}

void Teacher::Display(){

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆教師信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

if(0==length)

cout<<“無......”<

int i;

for(i=0;i

cout<

void Teacher::Del(char n[]){

int i,j,k;

for(i=0;i

if(strcmp(data[i].name,n)==0)

{

k=i+1;break;

}

if(k<1)cout<<“不存在姓名”<

for(j=k;j

data[j-1]=data[j];

length--;

cout<<“刪除人員信息成功......”<

void Teacher::Del(int i){

int j;

if(i<1||i>length)

cout<<“不存在第”<

for(j=i;j

data[j-1]=data[j];

length--;

cout<<“刪除成功......”<

istream& operator>>(istream& input,Telem& T){

int y,m,d;

cout<<“請輸入姓名(以*結尾):”<

input.getline(T.name,20,'*');

cout<<“請輸入性別(以*結尾 男或女):”<

input.getline(T.sex,10,'*');

cout<<“編號(以*結尾):”<

input.getline(T.num,20,'*');

cout<<“工資(以*結尾):”<

input.getline(T.wage,20,'*');

cout<<“請輸入出生日期:”<

input>>y>>m>>d;

T.birthtime.year=(y>=1900&&y<=2100)?y:1900;

T.birthtime.month=(m>=1&&m<=12)?m:1;

T.birthtime.day=(d>=1&&d<=31)?d:1;

cout<<“請輸入系別(以*結尾):”<

input.getline(T.department,20,'*');

cout<<“參加工作時間:”<

input>>y>>m>>d;

T.worktime.year=(y>=1900&&y<=2100)?y:1900;

T.worktime.month=(m>=1&&m<=12)?m:1;

T.worktime.day=(d>=1&&d<=31)?d:1;

return input;}

ostream& operator<<(ostream& output,Telem& T){

cout<<“姓名:”;

output<

cout<<“性別:”;

output<

cout<<“編號:”;

output<

cout<<“工資:”;

output<

cout<<“出生日期:”;

output<

cout<<“系別:”;

output<

cout<<“參加工作時間:”;

output<

cout<<“年齡:”;

output<

return output;}

int operator-(Time & t1,Time & t2){

return t1.year-t2.year;}

void Showmenu(){

cout<

cout<<“

歡 迎 進 入 教 職 工 信 息 管 理 系 統(tǒng)”<

cout<<“

2010 年7月7日發(fā)布”<<“

版權所有: swa”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★人員信息管理系統(tǒng)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“

1-從鍵盤錄入全部人員記錄

☆ ”<

cout<<“

☆ 2-增加一位人員記錄

★”<

cout<<“

3-顯示全部人員記錄

☆”<

cout<<“

☆ 4-按系別輸出人員信息(可選)★ ”<

cout<<“

5-按姓名或年齡檢索所有信息☆ ”<

cout<<“

☆ 6-顯示菜單目錄

★ ”<

cout<<“

7-結束程序運行

☆ ”<

cout<<“

★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

int main(){

Teacher tea;

worker stu;

People *pt=&tea;

People *ps=&stu;

int c=0,k=0,l=0,i=0;

char nam[20],part[20];Showmenu();

for(;;)

{

cout<<“請根據(jù)菜單執(zhí)行相應操作: ”;

cin>>c;

switch(c)

{

case 1:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★錄入全部人員記錄 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★從鍵盤輸入教師信息 ☆ ★ ☆ ★ ☆”<

pt->Addall();

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆從鍵盤輸入工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

ps->Addall();

break;

}

case 2:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆從鍵盤增加一位人員記錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆教師操作請按1 工人操作請按2 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

pt->Add();

else if(2==k)

ps->Add();

else

cout<<“操作錯誤...”<

break;

}

case 3:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆顯示全部人員記錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

pt->Display();

ps->Display();

break;

}

case 4:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆按部門輸出人員信息(可選)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

cout<<“ ★ ☆ ★ ☆ ★ ☆教師操作請按1 工人操作請按2 ★ ☆ ★ ☆ ★ ☆”<

cin>>k;

if(1==k)

{

cout<<“請輸入要輸出人員的系別(以*結尾):”<

pt->Displaypart(part);

}

else if(2==k)

{

cout<<“請輸入要輸出人員的系別(以*結尾):”<

ps->Displaypart(part);

}

else

cout<<“操作錯誤......”<

break;

}

case 5:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名或年齡檢索所有信息 ★ ☆ ★ ☆ ★ ☆ ★”<

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名查找1 按年齡查找2 ★ ☆ ★ ☆ ★ ☆ ★”<

cin>>k;

if(1==k)

{

cout<<“按姓名查找1 按年齡查找2”<>l;

if(1==l)

{

cout<<“請輸入要查找人員的姓名(以*結尾):”<

pt->Findname(nam);

}

else if(2==l)

{

cout<<“請輸入要查找人的年齡:”<>i;

pt->Findyear(i);

}

else

cout<<“操作錯誤......”<

}

else if(2==k)

{

cout<<“按姓名查找1 按年齡查找2”<>l;

if(1==l)

{

cout<<“請輸入要查找人員的姓名(以*結尾):”<

ps->Findname(nam);

}

else if(2==l)

{

cout<<“請輸入要查找人的年齡:”<>i;

ps->Findyear(i);

}

else

cout<<“操作錯誤......”<

}

else

cout<<“操作錯誤......”<

break;

}

case 6:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆顯示菜單目錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

Showmenu();

break;

}

case 7:

{

cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆結束程序運行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

exit(0);

}

default:cout<<“操作錯誤......”<

}

}

return 0;}

第五篇:C++大作業(yè)_職工信息管理系統(tǒng)源代碼

#include #include #include using namespace std;

const N=5000;// 定義系統(tǒng)可錄入的職工最大數(shù)值

string Ename[N];long Enum[N];char Esex[N];int Eage[N];

char Emarriage[N];int Edepart[N];int Eposition[N];int Edegree[N];int Eworktime[N];float Epay[N];

class Employee {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void NewInfo();

void ShowInfo();

void showall();

void showdepart(int depart);

void showdegree(int degree);

void showage(int min,int max);

void shownum(long number);

void RefreshInfo();

void DeleteInfo();

float Pay(int Employeegrade);

static int MaxNum();};

class DBOperate {

public:

string Employeename;

long Employeenum;

char Employeesex;

int Employeeage;

char Employeemarriage;

int Employeedepart;

int Employeeposition;

int Employeedegree;

int Employeeworktime;

float Employeepay;

static long EmployeeMaxNum;

static float EmployeeBasePay;

void WriteIn(int iflag);

void ReadOut();

void RefreshMaxNum(int iflag);//iflg=1 or-1 or 0 };

long Employee::EmployeeMaxNum = 1000;float Employee::EmployeeBasePay = 1500;

int Employee::MaxNum()//返回系統(tǒng)已經存儲的人數(shù)

{

int MN = 0;

ifstream myf;

myf.open(“EmployeeMaxNum.txt”);

myf>>MN;

cout<

myf.close();

return MN;}

void Employee::NewInfo()//添加新職工函數(shù)

{

cout<<“新職工姓名: ”;

cin>>Employee::Employeename;

Employee::Employeenum = EmployeeMaxNum + Employee::MaxNum()+1;

cout<<“新職工性別(F為女性,M為男性): ”;

cin>>Employee::Employeesex;

cout<<“新職工年齡: ”;

cin>>Employee::Employeeage;

cout<<“新職工婚姻狀況(Y為已婚,N為未婚): ”;

cin>>Employee::Employeemarriage;

cout<<“新職工學歷,請輸入相應學歷的序號: ”<

cout<<“ [1:小學 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:小學 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

cin>>Employee::Employeedegree;

}

cout<<“新職工所在部門,請輸入相應部門的序號:”<

cout<<“ [1:董事會 2:銷售部 3:人事部 4:客服中心 5:財務部 6:技術研發(fā)部 7:安全監(jiān)察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:董事會 2:銷售部 3:人事部 4:客服中心 5:財務部 6:技術研發(fā)部 7:安全監(jiān)察部] ”;

cin>>Employee::Employeedepart;

}

cout<<“新職工職位, 請輸入相應職位的序號: ”<

cout<<“ [1:臨時職工 2: 正式職工 3:部門經理 4:主任 5:董事長] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:臨時職員 2: 正式職員 3:部門經理 4:主任 5:董事長] ”;

cin>>Employee::Employeeposition;

}

cout<<“新職工的工作時長(不需要輸入單位): ”;

cin>>Employee::Employeeworktime;

Employee::Employeepay = Employee::Pay(Employee::Employeeposition);

DBOperate dbo;

dbo.ReadOut();

int MaxNum = Employee::MaxNum();

Enum[MaxNum] = Employee::Employeenum;

Ename[MaxNum] = Employee::Employeename;

Esex[MaxNum] = Employee::Employeesex;

Eage[MaxNum] = Employee::Employeeage;

Emarriage[MaxNum] = Employee::Employeemarriage;

Edegree[MaxNum] = Employee::Employeedegree;

Edepart[MaxNum] = Employee::Employeedepart;

Eposition[MaxNum] = Employee::Employeeposition;

Eworktime[MaxNum] = Employee::Employeeworktime;

Epay[MaxNum] = Employee::Employeepay;

dbo.WriteIn(1);

cout<<“ 添加新成員成功!”<

void Employee::ShowInfo()//程序主體 數(shù)據(jù)輸出函數(shù)

{

int choice1,choice2,min,max;

long searchnum;

Employee e;

cout<<“*******************************************”<

cout<<“-----------1.輸出全體職工信息--------------”<

cout<<“-----------2.按職工部門輸出----------------”<

cout<<“-----------3.按職工學歷輸出----------------”<

cout<<“-----------4.按職工年齡輸出----------------”<

cout<<“-----------5.按職工編號輸出----------------”<

cout<<“*******************************************”<

cout<<“ 請選擇查詢方式:”;

cin>>choice1;

switch(choice1)

{

case 1: showall();break;

case 2: cout<<“請輸入要查詢職工的部門編號[1:董事會 2:銷售部 3:人事部 4:客服中心 5:財務部 6:技術研發(fā)部 7:安全監(jiān)察部] ”;

cin>>choice2;

e.showdepart(choice2);break;

case 3: cout<<“請輸入要查詢職工的學歷編號: [1:小學 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

cin>>choice2;

e.showdegree(choice2);break;

case 4: cout<<“請輸入要查詢的年齡范圍: ”;

cout<<“最小值: ”;

cin>>min;

cout<<“最大值: ”;

cin>>max;

e.showage(min,max);break;

case 5: cout<<“請輸入要查詢的職工編號: ”;

cin>>searchnum;

e.shownum(searchnum);break;

default: cout<<“出錯啦!”<

} }

void Employee::showall()//全體職工輸出函數(shù)

{ int i;

long number;

for(i=0;i

{

number = Enum[i];

shownum(number);

} }

void Employee::showdepart(int depart)//按職工所在部門輸出函數(shù)

{

int i;

switch(depart)

{

case 1: cout<<“董事會的成員有: ”<

case 2: cout<<“銷售部的成員有: ”<

case 3: cout<<“人事部的成員有: ”<

case 4: cout<<“客服中心的成員有: ”<

case 5: cout<<“財務部的成員有: ”<

case 6: cout<<“技術研發(fā)部的成員有: ”<

case 7: cout<<“安全監(jiān)察部的成員有: ”<

default: cout<<“輸入錯誤!>”<

}

for(i=0;i

{

if(Edepart[i] == depart)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::showdegree(int degree)//按職工學歷輸出函數(shù)

{

int i;

switch(degree)

{

case 1:cout<<“初中學歷的員工有:”<

case 2:cout<<“初中學歷的員工有:”<

case 3:cout<<“高中學歷的員工有:”<

case 4:cout<<“本科學歷的員工有:”<

case 5:cout<<“碩士學位的員工有:”<

case 6:cout<<“博士學位的員工有:”<

}

for(i=0;i

{

if(Edegree[i] == degree)

{

long number = Enum[i];

shownum(number);

} else continue;

} }

void Employee::showage(int min,int max)//按職工年齡段輸出函數(shù)

{

int i;

for(i=0;i

{

if(Eage[i]>=min&&Eage[i]<=max)

{

long number = Enum[i];

shownum(number);

}

else continue;

} }

void Employee::shownum(long number)//按職工編號輸出函數(shù)

{

int i;

for(i=0;i

{

if(Enum[i] == number)

{

cout<<“**********************************”<

cout<<“職工編號:”<

cout<<“姓 名:”<

cout<<“性 別:”;

if(Esex[i]=='F')cout<<“女 ”<

else if(Esex[i]=='M')cout<<“男 ”<

cout<<“年 齡:”<

cout<<“婚姻情況:”;

if(Emarriage[i]=='Y')cout<<“已婚 ”<

else if(Emarriage[i]=='N')cout<<“未婚 ”<

cout<<“學 歷:”;

switch(Edegree[i])

{

case 1:cout<<“小 學 ”<

case 2:cout<<“初 中 ”<

case 3:cout<<“高 中 ”<

case 4:cout<<“本 科 ”<

case 5:cout<<“碩 士 ”<

case 6:cout<<“博 士 ”<

}

cout<<“所在部門:”;

switch(Edepart[i])

{

case 1:cout<<“董事會 ”<

case 2:cout<<“銷售部 ”<

case 3:cout<<“人事部 ”<

case 4:cout<<“客服中心 ”<

case 5:cout<<“財務部 ”<

case 6:cout<<“技術研發(fā)部 ”<

case 7:cout<<“安全監(jiān)察部 ”<

}

cout<<“所任職務:”;

switch(Eposition[i])

{

case 1:cout<<“臨時成員 ”<

case 2:cout<<“正式員工 ”<

case 3:cout<<“部門經理 ”<

case 4:cout<<“主任 ”<

case 5:cout<<“董事長 ”<

}

cout<<“工作時長:”<

cout<<“工資:”<

cout<<“**********************************”<

}

else continue;

} }

void Employee::RefreshInfo()//修改職工信息的函數(shù) {

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“請輸入您要修改的職工編號:”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

{

Employee::shownum(cNum);

cout<<“請輸入該職工的新信息: ”<

cout<<“職工姓名: ”;//錄入職工的新的數(shù)據(jù),職工編號保持不變

cin>>Employee::Employeename;

Ename[i] = Employee::Employeename;

cout<<“職工性別(F為女性,M為男性): ”;

cin>>Employee::Employeesex;

Esex[i] = Employee::Employeesex;

cout<<“職工年齡: ”;

cin>>Employee::Employeeage;

Eage[i] = Employee::Employeeage;

cout<<“職工婚姻狀況(Y為已婚,N為未婚): ”;

cin>>Employee::Employeemarriage;

Emarriage[i] = Employee::Employeemarriage;

cout<<“職工學歷,請輸入相應學歷的序號:”<

cout<<“ [1:小學 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

cin>>Employee::Employeedegree;

while(Employee::Employeedegree!=1&&Employee::Employeedegree!=2&&Employee::Employeedegree!=3&&Employee::Employeedegree!=4&&Employee::Employeedegree!=5&&Employee::Employeedegree!=6)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:小學 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

cin>>Employee::Employeedegree;

}

Edegree[i] = Employee::Employeedegree;

cout<<“職工所在部門,請輸入相應部門的序號: ”<

cout<<“ [1:董事會 2:銷售部 3:人事部 4:客服中心 5:財務部 6:技術研發(fā)部 7:安全監(jiān)察部] ”;

cin>>Employee::Employeedepart;

while(Employee::Employeedepart!=1&&Employee::Employeedepart!=2&&Employee::Employeedepart!=3&&Employee::Employeedepart!=4&&Employee::Employeedepart!=5&&Employee::Employeedepart!=6&&Employee::Employeedepart!=7)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:董事會 2:銷售部 3:人事部 4:客服中心 5:財務部 6:技術研發(fā)部 7:安全監(jiān)察部] ”;

cin>>Employee::Employeedepart;

}

Edepart[i] = Employee::Employeedepart;

cout<<“職工職位,請輸入相應職位的序號:”<

cout<<“ [1:臨時職員 2: 正式職員 3:部門經理 4:主任 5:董事長] ”;

cin>>Employee::Employeeposition;

while(Employee::Employeeposition!=1&&Employee::Employeeposition!=2&&Employee::Employeeposition!=3&&Employee::Employeeposition!=4&&Employee::Employeeposition!=5)

{

cout<<“輸入有誤,請重新輸入:”<

cout<<“ [1:臨時職員 2: 正式職員 3:部門經理 4:主任 5:董事長] ”;

cin>>Employee::Employeeposition;

}

Eposition[i] = Employee::Employeeposition;

cout<<“員工的工作時(不需要輸入單位): ”;

cin>>Employee::Employeeworktime;

Eworktime[i] = Employee::Employeeworktime;

Epay[i] = Employee::Pay(Employee::Employeeposition);

break;

}

}

dbo.WriteIn(0);}

void Employee::DeleteInfo()//刪除職工數(shù)據(jù)的函數(shù)

{

char tmp;

int cNum = 1000;

DBOperate dbo;

dbo.ReadOut();

void Employee::shownum(long number);

cout<<“請輸入您要刪除的職工編號>: ”;

cin>>cNum;

int MN;

MN = Employee::MaxNum();

for(int i=0;i

{

if(Enum[i] == cNum)

Employee::shownum(cNum);

}

cout<<“確認要刪除該職工信息?(Y為確認,N為放棄): ”;

cin>>tmp;

if(tmp=='Y')

{

if(i==MN-1)

dbo.WriteIn(-1);

else

{

for(int j=i;j

{ Enum[j] = Enum[j+1];}

dbo.WriteIn(-1);

}

cout<<“ 刪除操作成功!”<

} }

float Employee::Pay(int Employeeposition)//根據(jù)職工職位計算工資的函數(shù)

{

float tmpPay;

tmpPay = Employee::EmployeeBasePay + Employee::Employeeposition Employee::EmployeeBasePay;

*

return tmpPay;}

void DBOperate::WriteIn(int iflag)//數(shù)據(jù)操作函數(shù)—寫入

{

DBOperate::RefreshMaxNum(iflag);

ofstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf<

}

myf.close();

return;}

void DBOperate::ReadOut()//數(shù)據(jù)操作函數(shù)—讀出

{

ifstream myf(“Employee.txt”);

Employee e;

int MN;

MN = e.MaxNum();

for(int i=0;i

{

myf>>DBOperate::Employeenum>>DBOperate::Employeename>>DBOperate::Employeesex>>DBOperate::Employeeage>>DBOperate::Employeemarriage

>>DBOperate::Employeedegree>>DBOperate::Employeedepart>>DBOperate::Employeeposition>>DBOperate::Employeeworktime>>DBOperate::Employeepay;

Enum[i] = DBOperate::Employeenum;

Ename[i] = DBOperate::Employeename;

Esex[i] = DBOperate::Employeesex;

Eage[i] = DBOperate::Employeeage;

Emarriage[i] = DBOperate::Employeemarriage;

Edegree[i] = DBOperate::Employeedegree;

Edepart[i] = DBOperate::Employeedepart;

Eposition[i] = DBOperate::Employeeposition;

Eworktime[i] = DBOperate::Employeeworktime;

Epay[i] = DBOperate::Employeepay;

}

myf.close();}

void DBOperate::RefreshMaxNum(int iflag)//更新系統(tǒng)中員工計數(shù)文件的函數(shù)

{

int MaxNum = 0;

ifstream myif(“EmployeeMaxNum.txt”);

myif>>MaxNum;

myif.close();

MaxNum = MaxNum+iflag;

ofstream myof(“EmployeeMaxNum.txt”);

myof<

myof.close();}

int main()//主函數(shù)

{

system(“color B0”);//設置當前窗口的背景色和前景色

// 0 = 黑色

= 灰色

// 1 = 藍色

= 淡藍色

// 2 = 綠色

A = 淡綠色

// 3 = 淺綠色 B = 淡淺綠色

// 4 = 紅色

C = 淡紅色

// 5 = 紫色

D = 淡紫色

// 6 = 黃色

E = 淡黃色

// 7 = 白色

F = 亮白色

int select = 0;

while(select!=5)

{

cout<<“ ╭————————————————————————————╮”<

cout<<“ ∣

《主菜單》

∣”<

cout<<“ ├————————————————————————————┤”<

cout<<“ ∣

1.新建并錄入職工信息

∣”<

cout<<“ ∣

2.按條件輸出職工信息

∣”<

cout<<“ ∣

3.修改指定職工的信息

∣”<

cout<<“ ∣

4.刪除職工信息

∣”<

cout<<“ ∣

5.退出系統(tǒng)

∣”<

cout<<“ ╰————————————————————————————╯”<

cout<<“ ——————————————————————————————”<

cout<<“ 請選擇您需要功能的代號: ”;

cin>>select;

Employee e;

DBOperate dbo;

switch(select)

{

case 1:

e.NewInfo();break;

case 2:

dbo.ReadOut();

e.ShowInfo();break;

case 3:

e.RefreshInfo();break;

case 4:

e.DeleteInfo();break;

case 5: cout<<“ 退出成功”<

default: cout<<“命令錯誤!”<

}

if(select == 5)

break;

}

exit(1);

return 0;}

下載簡單學生信息管理系統(tǒng)C++范文word格式文檔
下載簡單學生信息管理系統(tǒng)C++范文.doc
將本文檔下載到自己電腦,方便修改和收藏,請勿使用迅雷等下載。
點此處下載文檔

文檔為doc格式


聲明:本文內容由互聯(lián)網(wǎng)用戶自發(fā)貢獻自行上傳,本網(wǎng)站不擁有所有權,未作人工編輯處理,也不承擔相關法律責任。如果您發(fā)現(xiàn)有涉嫌版權的內容,歡迎發(fā)送郵件至:645879355@qq.com 進行舉報,并提供相關證據(jù),工作人員會在5個工作日內聯(lián)系你,一經查實,本站將立刻刪除涉嫌侵權內容。

相關范文推薦

    學生信息管理系統(tǒng)

    摘 要 隨著網(wǎng)絡通信技術的迅速發(fā)展和信息技術的廣泛應用,計算機的應用已普及到經濟和社會生活的各個領域。教育領域也不例外,現(xiàn)今已經出現(xiàn)了各種遠程網(wǎng)絡在線教育系統(tǒng)、圖書館......

    學生信息管理系統(tǒng)

    –––––––––––––––––摘 要––––––––––––––––– 學生信息管理系統(tǒng)是典型的信息管理系統(tǒng) (MIS),其開發(fā)主要包括后臺數(shù)據(jù)庫的建立和維護以及前端......

    學生信息管理系統(tǒng)

    目 錄 第一章:類圖 ........................................................ 5 第二章:用例描述與用例圖 ............................................ 6 2.1 用例圖 .........

    學生信息管理系統(tǒng)

    學生信息管理系統(tǒng)論文 2010-04-01清華領導力培訓諾貝爾論文網(wǎng) 在傳統(tǒng)模式下利用人工進行學生信息管理系統(tǒng)論文,存在著較多缺點,如:效率底,保密性差,時間一長將產生大量文件和數(shù)據(jù)......

    學生信息管理系統(tǒng)5篇

    學生管理信息系統(tǒng) 隨著學校規(guī)模的不斷擴大,學生數(shù)量的不斷增加,學生的信息量也成倍增長。學生管理工作是學校各項工作的一個重要部分,其管理水平的高低將直接影響到人才的培養(yǎng)......

    學生信息管理系統(tǒng)論文

    學生信息管理系統(tǒng)論文 2010-04-01 清華領導力培訓諾貝爾論文網(wǎng) 在傳統(tǒng)模式下利用人工進行學生信息管理系統(tǒng)論文,存在著較多缺點,如:效率底,保密性差,時間一長將產生大量文件和數(shù)......

    VB學生信息管理系統(tǒng)

    學生信息管理系統(tǒng) 前 言 學生籍管理系統(tǒng)是一個教育單位不可缺少的部分,它的內容對于學校的決策者和管理者來說都至關重要,所以學生學生信息管理系統(tǒng)應該能夠為用戶提供充足......

    學生信息管理系統(tǒng)畢業(yè)論文

    ``````Q ASP.NET學生信息管理系統(tǒng)畢業(yè)論文 摘 要??? 隨著信息技術在管理上越來越深入而廣泛的應用,管理信息系統(tǒng)的實施在技術上已逐步成熟。管理信息系統(tǒng)是一個不斷發(fā)展......

主站蜘蛛池模板: 久久久久亚洲精品无码蜜桃| 亚洲а∨天堂久久精品| 国产成人精品亚洲一区| 亚洲人成在线观看网站不卡| 波多野结衣av一区二区无码| 亚洲免费国产午夜视频| 午夜夜伦鲁鲁片免费无码| 色88久久久久高潮综合影院| 色妺妺在线视频| 一二三四区无产乱码1000集| 国产伦精品一区二区三区妓女下载| 97久久人人超碰超碰窝窝| 尹人香蕉久久99天天拍久女久| 99亚洲精品久久久99| 成年永久一区二区三区免费视频| 东京热一精品无码av| 中文字幕无码人妻aaa片| 《人妻大乳被揉2》| 性刺激视频免费观看| 欧洲少妇性喷潮| 久久国内精品自在自线波多野结氏| a在线视频v视频| 精品久久久久成人码免费动漫| 国产精品爽爽va在线观看无码| 久久国产人妻一区二区免费| 国产精品好好热av在线观看| 日韩精品无码av成人观看| 337p日本欧洲亚洲大胆精筑| 日本电影一区二区三区| 麻豆精品传媒一二三区艾秋| 麻豆蜜桃av蜜臀av色欲av| 亚洲一区二区三区乱码在线欧洲| 国产精品久久国产精品99 gif| 无码国产精品一区二区vr| 国产精品揄拍100视频| 色与欲影视天天看综合网| 色综合久久网| 麻豆精品一区综合av在线| 国产精品极品美女自在线观看免费| 国产三级精品三级在线专区1| 色哟哟精品视频在线观看|