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

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

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

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

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

      C++課程設(shè)計(jì) 教職工信息管理系統(tǒng)源代碼

      時(shí)間:2019-05-14 03:48:47下載本文作者:會(huì)員上傳
      簡(jiǎn)介:寫寫幫文庫(kù)小編為你整理了多篇相關(guān)的《C++課程設(shè)計(jì) 教職工信息管理系統(tǒng)源代碼》,但愿對(duì)你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫(kù)還可以找到更多《C++課程設(shè)計(jì) 教職工信息管理系統(tǒng)源代碼》。

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

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

      #include #include #include #include

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

      class Time //時(shí)間類 {

      public:

      int year;

      int month;

      int day;};

      class Telem //個(gè)人信息 {

      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)自動(dò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 編號(hào)3 工資4 出生日期5 工作時(shí)間6 年齡7 系別8 退出選擇9”<

      while(cin>>c)

      {

      switch(c)

      {

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

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

      case 3: cout<<“編號(hào):”<

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

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

      case 6: cout<<“工作時(shí)間:”<

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

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

      case 9: goto loop;

      default:cout<<“操作錯(cuò)誤......”<

      }

      }

      loop:;

      } }

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

      int i;

      for(i=0;i

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

      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);//文件的打開(kāi)與關(guān)閉

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

      {

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

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

      length++;

      if(length==maxsize)

      {

      flag=1;

      goto loop;

      }

      }

      People::Del(length);

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

      loop:

      if(1==flag)

      cout<<“人員信息儲(chǔ)存空間已滿......”<

      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<<“人員信息儲(chǔ)存空間已滿......”<

      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<<“人員信息儲(chǔ)存空間已滿......”<

      iofile.close();}

      void worker::Display(){

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

      if(0==length)

      cout<<“無(wú)......”<

      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<<“人員信息儲(chǔ)存空間已滿......”<

      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<<“人員信息儲(chǔ)存空間已滿......”<

      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<<“人員信息儲(chǔ)存空間已滿......”<

      iofile.close();}

      void Teacher::Display(){

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

      if(0==length)

      cout<<“無(wú)......”<

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

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

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

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

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

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

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

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

      cout<<“請(qǐng)輸入出生日期:”<

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

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

      cout<<“參加工作時(shí)間:”<

      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<<“編號(hào):”;

      output<

      cout<<“工資:”;

      output<

      cout<<“出生日期:”;

      output<

      cout<<“系別:”;

      output<

      cout<<“參加工作時(shí)間:”;

      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é)束程序運(yùn)行

      ☆ ”<

      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<<“請(qǐng)根據(jù)菜單執(zhí)行相應(yīng)操作: ”;

      cin>>c;

      switch(c)

      {

      case 1:

      {

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

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

      pt->Addall();

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

      ps->Addall();

      break;

      }

      case 2:

      {

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

      cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆教師操作請(qǐng)按1 工人操作請(qǐng)按2 ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

      cin>>k;

      if(1==k)

      pt->Add();

      else if(2==k)

      ps->Add();

      else

      cout<<“操作錯(cuò)誤...”<

      break;

      }

      case 3:

      {

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

      pt->Display();

      ps->Display();

      break;

      }

      case 4:

      {

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

      cout<<“ ★ ☆ ★ ☆ ★ ☆教師操作請(qǐng)按1 工人操作請(qǐng)按2 ★ ☆ ★ ☆ ★ ☆”<

      cin>>k;

      if(1==k)

      {

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

      pt->Displaypart(part);

      }

      else if(2==k)

      {

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

      ps->Displaypart(part);

      }

      else

      cout<<“操作錯(cuò)誤......”<

      break;

      }

      case 5:

      {

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

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

      cin>>k;

      if(1==k)

      {

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

      if(1==l)

      {

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

      pt->Findname(nam);

      }

      else if(2==l)

      {

      cout<<“請(qǐng)輸入要查找人的年齡:”<>i;

      pt->Findyear(i);

      }

      else

      cout<<“操作錯(cuò)誤......”<

      }

      else if(2==k)

      {

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

      if(1==l)

      {

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

      ps->Findname(nam);

      }

      else if(2==l)

      {

      cout<<“請(qǐng)輸入要查找人的年齡:”<>i;

      ps->Findyear(i);

      }

      else

      cout<<“操作錯(cuò)誤......”<

      }

      else

      cout<<“操作錯(cuò)誤......”<

      break;

      }

      case 6:

      {

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

      Showmenu();

      break;

      }

      case 7:

      {

      cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆結(jié)束程序運(yùn)行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”<

      exit(0);

      }

      default:cout<<“操作錯(cuò)誤......”<

      }

      }

      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)存儲(chǔ)的人數(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é)歷,請(qǐng)輸入相應(yīng)學(xué)歷的序號(hào): ”<

      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<<“輸入有誤,請(qǐng)重新輸入:”<

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

      cin>>Employee::Employeedegree;

      }

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

      cout<<“ [1:董事會(huì) 2:銷售部 3:人事部 4:客服中心 5:財(cái)務(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<<“輸入有誤,請(qǐng)重新輸入:”<

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

      cin>>Employee::Employeedepart;

      }

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

      cout<<“ [1:臨時(shí)職工 2: 正式職工 3:部門經(jīng)理 4:主任 5:董事長(zhǎng)] ”;

      cin>>Employee::Employeeposition;

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

      {

      cout<<“輸入有誤,請(qǐng)重新輸入:”<

      cout<<“ [1:臨時(shí)職員 2: 正式職員 3:部門經(jīng)理 4:主任 5:董事長(zhǎng)] ”;

      cin>>Employee::Employeeposition;

      }

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

      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.按職工編號(hào)輸出----------------”<

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

      cout<<“ 請(qǐng)選擇查詢方式:”;

      cin>>choice1;

      switch(choice1)

      {

      case 1: showall();break;

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

      cin>>choice2;

      e.showdepart(choice2);break;

      case 3: cout<<“請(qǐng)輸入要查詢職工的學(xué)歷編號(hào): [1:小學(xué) 2:初中 3:高中 4:本科 5:碩士 6:博士] ”;

      cin>>choice2;

      e.showdegree(choice2);break;

      case 4: cout<<“請(qǐng)輸入要查詢的年齡范圍: ”;

      cout<<“最小值: ”;

      cin>>min;

      cout<<“最大值: ”;

      cin>>max;

      e.showage(min,max);break;

      case 5: cout<<“請(qǐng)輸入要查詢的職工編號(hào): ”;

      cin>>searchnum;

      e.shownum(searchnum);break;

      default: cout<<“出錯(cuò)啦!”<

      } }

      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<<“董事會(huì)的成員有: ”<

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

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

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

      case 5: cout<<“財(cái)務(wù)部的成員有: ”<

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

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

      default: cout<<“輸入錯(cuò)誤!>”<

      }

      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)//按職工編號(hào)輸出函數(shù)

      {

      int i;

      for(i=0;i

      {

      if(Enum[i] == number)

      {

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

      cout<<“職工編號(hào):”<

      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<<“董事會(huì) ”<

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

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

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

      case 5:cout<<“財(cái)務(wù)部 ”<

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

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

      }

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

      switch(Eposition[i])

      {

      case 1:cout<<“臨時(shí)成員 ”<

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

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

      case 4:cout<<“主任 ”<

      case 5:cout<<“董事長(zhǎng) ”<

      }

      cout<<“工作時(shí)長(zhǎng):”<

      cout<<“工資:”<

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

      }

      else continue;

      } }

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

      int cNum = 1000;

      DBOperate dbo;

      dbo.ReadOut();

      void Employee::shownum(long number);

      cout<<“請(qǐng)輸入您要修改的職工編號(hào):”;

      cin>>cNum;

      int MN;

      MN = Employee::MaxNum();

      for(int i=0;i

      {

      if(Enum[i] == cNum)

      {

      Employee::shownum(cNum);

      cout<<“請(qǐng)輸入該職工的新信息: ”<

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

      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é)歷,請(qǐng)輸入相應(yīng)學(xué)歷的序號(hào):”<

      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<<“輸入有誤,請(qǐng)重新輸入:”<

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

      cin>>Employee::Employeedegree;

      }

      Edegree[i] = Employee::Employeedegree;

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

      cout<<“ [1:董事會(huì) 2:銷售部 3:人事部 4:客服中心 5:財(cái)務(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<<“輸入有誤,請(qǐng)重新輸入:”<

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

      cin>>Employee::Employeedepart;

      }

      Edepart[i] = Employee::Employeedepart;

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

      cout<<“ [1:臨時(shí)職員 2: 正式職員 3:部門經(jīng)理 4:主任 5:董事長(zhǎng)] ”;

      cin>>Employee::Employeeposition;

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

      {

      cout<<“輸入有誤,請(qǐng)重新輸入:”<

      cout<<“ [1:臨時(shí)職員 2: 正式職員 3:部門經(jīng)理 4:主任 5:董事長(zhǎng)] ”;

      cin>>Employee::Employeeposition;

      }

      Eposition[i] = Employee::Employeeposition;

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

      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<<“請(qǐng)輸入您要?jiǎng)h除的職工編號(hào)>: ”;

      cin>>cNum;

      int MN;

      MN = Employee::MaxNum();

      for(int i=0;i

      {

      if(Enum[i] == cNum)

      Employee::shownum(cNum);

      }

      cout<<“確認(rèn)要?jiǎng)h除該職工信息?(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ù)職工職位計(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)中員工計(jì)數(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<<“ 請(qǐng)選擇您需要功能的代號(hào): ”;

      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<<“命令錯(cuò)誤!”<

      }

      if(select == 5)

      break;

      }

      exit(1);

      return 0;}

      第三篇:航空售票系統(tǒng)+C++課程設(shè)計(jì)源代碼

      #include #include #define M 5//每種飛機(jī)票的總數(shù)目 #define N 3//飛機(jī)票的總數(shù)目 class Plane {private: char name[40];//終點(diǎn)站名

      int number;//航班號(hào)

      int Number;//飛機(jī)號(hào)

      int week;//星期幾飛行

      int day;//日期

      int left;//余票額

      int n;//與數(shù)組flag一起確定客戶訂票狀態(tài) public:

      int flag[20];//訂票狀態(tài)數(shù)組,-1為預(yù)訂票,1為已定票,0為初始化狀態(tài)

      Plane()//構(gòu)造函數(shù)

      {

      name[0]='