欧美色欧美亚洲高清在线观看,国产特黄特色a级在线视频,国产一区视频一区欧美,亚洲成a 人在线观看中文

  1. <ul id="fwlom"></ul>

    <object id="fwlom"></object>

    <span id="fwlom"></span><dfn id="fwlom"></dfn>

      <object id="fwlom"></object>

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

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

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

      #include

      #include

      using namespace std;

      int i=0;

      void layout()

      {

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

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

      cout<<“0.輸入學(xué)生信息”<

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

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

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

      cout<<“4.按學(xué)號修改學(xué)生信息”<

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

      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學(xué)號t姓名t性別t學(xué)科一t學(xué)科二t平均分”<

      }

      //學(xué)生信息輸入//

      void INPUT()

      {

      int j=0;

      int x;

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

      cout<<“請輸入學(xué)生信息:”<

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

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

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

      i++;

      cout<<“是否繼續(xù)輸入學(xué)生信息?是:請輸入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)計學(xué)科平均分//

      void xueke()

      {

      double q1;

      double sum1;

      int p1;

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

      {

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

      }

      q1=sum1/i;

      cout<<“學(xué)科一平均成績:”<

      double q2;

      double sum2;

      int p2;

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

      {

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

      }

      q2=sum2/i;

      cout<<“學(xué)科二平均成績:”<

      }

      //統(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<<“學(xué)科二平均成績:”<

      }

      }

      }

      //按學(xué)號查詢學(xué)生信息//

      void chaxun()

      {int x;

      cout<<“請輸入學(xué)號:”;

      cin>>x;

      int p;

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

      {

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

      {

      show_1();

      stu[p].show();

      }

      }

      }

      //按學(xué)號修改學(xué)生信息//

      void xiugai()

      {

      int j;

      int x;

      cout<<“請輸入需修改學(xué)號:”;

      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<<“請輸入學(xué)生信息:”<

      cout<<“班級:t”<<“學(xué)號:t”<<“姓名:t”<<“性別:t”<<“學(xué)科一:t”<<“學(xué)科二: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”<<“學(xué)號:t”<<“姓名:t”<<“性別:t”<<“學(xué)科一:t”<<“學(xué)科二: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++課程設(shè)計學(xué)生信息管理系統(tǒng)

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

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

      二、目的與要求

      1.目的:

      (1)掌握面向?qū)ο蟪绦蛟O(shè)計的基本思路和方法;

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

      組裝與整體調(diào)試的全過程;

      (3)進(jìn)一步熟悉C++中類的概念、類的封裝、繼承的實現(xiàn)方式;(4)學(xué)會分析簡單的實際問題,并能利用所學(xué)的知識建立系統(tǒng)的邏輯結(jié)構(gòu),學(xué)會簡單的調(diào)試技巧和方法。逐步熟悉面向?qū)ο蟪绦蛟O(shè)計的方法,養(yǎng)成良好的編程習(xí)慣。

      2.要求基本要求:

      (1)要求利用C++面向?qū)ο蟮木幊趟枷雭硗瓿上到y(tǒng)的設(shè)計;(2)進(jìn)行簡單界面設(shè)計,能夠?qū)崿F(xiàn)友好的交互;(3)具有清晰的程序流程圖和數(shù)據(jù)結(jié)構(gòu)的詳細(xì)定義;(4)熟練掌握C++對文件的各種操作。

      三、信息描述

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

      四、功能描述

      1.添加、刪除

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

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

      3.修改

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

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

      五、解決方案

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

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

      六、進(jìn)度安排

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

      1.分析設(shè)計階段。指導(dǎo)教師應(yīng)積極引導(dǎo)學(xué)生自主學(xué)習(xí)和鉆研問題,明確

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

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

      課題要求的功能。

      3.總結(jié)報告階段:總結(jié)設(shè)計工作,寫出課程設(shè)計說明書,要求學(xué)生寫出需

      求分析、總體設(shè)計、詳細(xì)設(shè)計、編碼、測試的步驟和內(nèi)容。4.考核階段。

      七、撰寫課程設(shè)計報告或課程設(shè)計總結(jié)

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

      八、參考資料

      《C++語言程序設(shè)計教程》

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

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

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

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

      學(xué)生成績管理系統(tǒng)主函數(shù)主菜單錄入學(xué)生信息保存信息到文件瀏覽學(xué)生信息按姓名或?qū)W號查詢信息刪除信息退出系統(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);//把文件從硬盤上讀入內(nèi)存 void fileWrite(chainList *list,ofstream &ff);//寫入硬盤

      int compareStr(char*str1,char*str2);//名字作為關(guān)鍵字,這個函數(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)//為何輸入不存在地文件后,機子變得很慢,而且沒有結(jié)果出來?

      {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);//如果文件已經(jīng)存在,詢問是否覆蓋。如何知道是否存在 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永遠(yuǎn)指向插入位置前一個位置。

      ss->next=p->next;

      p->next=ss;

      p=ss;

      break;

      }

      p=p->next;

      }

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

      if(q->next)

      q=q->next;//q前進(jìn)一步。

      } }

      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永遠(yuǎn)指向插入位置前一個位置。

      ss->next=p->next;

      p->next=ss;

      p=ss;

      break;

      }

      p=p->next;

      }

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

      if(q->next)

      q=q->next;//q前進(jìn)一步。

      } } 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.瀏覽學(xué)生信息

      開始N開始YNY輸出所有信息返回主菜單錄入信息保存信息返回主菜單打開文件文件中有無信息結(jié)束3.按姓名或?qū)W號查詢信息

      4.刪除信息

      開始NY輸入姓名或?qū)W號開始NY輸入姓名或?qū)W號N

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

      心得體會:

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

      第四篇:C++課程設(shè)計 教職工信息管理系統(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ù)組的內(nèi)容

      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)自動生成的構(gòu)造函數(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);//文件的打開與關(guān)閉

      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<<“請輸入姓名(以*結(jié)尾):”<

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

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

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

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

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

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

      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<<“請輸入系別(以*結(jié)尾):”<

      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<<“

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

      cout<<“

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

      版權(quán)所有: swa”<

      cout<<“

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

      cout<<“

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

      ☆ ”<

      cout<<“

      ☆ 2-增加一位人員記錄

      ★”<

      cout<<“

      3-顯示全部人員記錄

      ☆”<

      cout<<“

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

      cout<<“

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

      cout<<“

      ☆ 6-顯示菜單目錄

      ★ ”<

      cout<<“

      7-結(jié)束程序運行

      ☆ ”<

      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í)行相應(yīng)操作: ”;

      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<<“請輸入要輸出人員的系別(以*結(jié)尾):”<

      pt->Displaypart(part);

      }

      else if(2==k)

      {

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

      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<<“請輸入要查找人員的姓名(以*結(jié)尾):”<

      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<<“請輸入要查找人員的姓名(以*結(jié)尾):”<

      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<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆結(jié)束程序運行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

      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)已經(jī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<<“新職工學(xué)歷,請輸入相應(yīng)學(xué)歷的序號: ”<

      cout<<“ [1:小學(xué) 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:小學(xué) 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

      cin>>Employee::Employeedegree;

      }

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

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

      cin>>Employee::Employeedepart;

      }

      cout<<“新職工職位, 請輸入相應(yīng)職位的序號: ”<

      cout<<“ [1:臨時職工 2: 正式職工 3:部門經(jīng)理 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:部門經(jīng)理 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.按職工學(xué)歷輸出----------------”<

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

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

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

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

      cin>>choice1;

      switch(choice1)

      {

      case 1: showall();break;

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

      cin>>choice2;

      e.showdepart(choice2);break;

      case 3: cout<<“請輸入要查詢職工的學(xué)歷編號: [1:小學(xué) 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<<“財務(wù)部的成員有: ”<

      case 6: cout<<“技術(shù)研發(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)//按職工學(xué)歷輸出函數(shù)

      {

      int i;

      switch(degree)

      {

      case 1:cout<<“初中學(xué)歷的員工有:”<

      case 2:cout<<“初中學(xué)歷的員工有:”<

      case 3:cout<<“高中學(xué)歷的員工有:”<

      case 4:cout<<“本科學(xué)歷的員工有:”<

      case 5:cout<<“碩士學(xué)位的員工有:”<

      case 6:cout<<“博士學(xué)位的員工有:”<

      }

      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<<“學(xué) 歷:”;

      switch(Edegree[i])

      {

      case 1:cout<<“小 學(xué) ”<

      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<<“財務(wù)部 ”<

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

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

      }

      cout<<“所任職務(wù):”;

      switch(Eposition[i])

      {

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

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

      case 3:cout<<“部門經(jīng)理 ”<

      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<<“職工學(xué)歷,請輸入相應(yīng)學(xué)歷的序號:”<

      cout<<“ [1:小學(xué) 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:小學(xué) 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

      cin>>Employee::Employeedegree;

      }

      Edegree[i] = Employee::Employeedegree;

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

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

      cin>>Employee::Employeedepart;

      }

      Edepart[i] = Employee::Employeedepart;

      cout<<“職工職位,請輸入相應(yīng)職位的序號:”<

      cout<<“ [1:臨時職員 2: 正式職員 3:部門經(jīng)理 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:部門經(jīng)理 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<<“確認(rèn)要刪除該職工信息?(Y為確認(rèn),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”);//設(shè)置當(dāng)前窗口的背景色和前景色

      // 0 = 黑色

      = 灰色

      // 1 = 藍(lán)色

      = 淡藍(lán)色

      // 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;}

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

      文檔為doc格式


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

      相關(guān)范文推薦

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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