学生毕业设计管理系统一、设计项目:完成学生毕业设计管理系统

monica的私人花园 2021-09-19 09:08 282 次浏览 赞 147

最新问答

  • 淘气别闹

    #include
      #include
      #include
      #include
      #include
      using namespace std;
      int amount=0;
      int num=100000000; //当前最高学号
      ofstream *file[50];
      /////////////////////////////////*信息结构体*////////////////////////////////////////
      struct info
      {
      string yw;
      string sx;
      string yy;
      string wl;
      string hx;
      string sw;
      struct info *next;
      };
      /////////////////////////////////*类*////////////////////////////////////////
      class student
      {
      public:
      int id;
      string mun;
      string name;
      info sc3;
      class student *next;
      };
      /////////////////////////////////*函数声明*////////////////////////////////////////
      void input(student *head); //录入
      void search1(student *head); //姓名查询
      void search2(student *head); //学号查询
      void change(student *head); //修改
      void shanchu(student *head); //删除
      void get(student *head); //取
      void display(); //显示菜单
      void show(student *head); //显示
      void readin(student *head); //保存
      void chushihua(student *head); //初始化
      string int_char(int);
      /////////////////////////////////*主函数*////////////////////////////////////////
      void main() //主函数
      {
      system("color f0");
      char x;
      bool flag2=0;
      student *head=new student; //初始化
      head->next=NULL;
      cout<<" ★ 欢迎使用信息管理系统 ★ \n ";
      display(); //显示菜单
      do
      {
      do
      {
      cin>>x;
      if((x>='0'&&x<='8'))
      flag2=1;
      else
      {
      cout<<"指令错误!!!!!!!!!!"<  cout<<" 请选择相应的数字进行作: ";
      }
      }while(flag2==0);
      switch(x)
      {
      case '0':cout<<"******************************现在进行信息录入******************************\n";
      input(head);
      cout<<"输入的信息为:\n";
      show(head);
      cout<<"********************************************************************************\n";
      display(); break;
      case '1':
      {
      char z;
      cout<<"******************************现在进行信息查询******************************\n";
      cout<<"请选择查询方式:";
      cout<<"(0).姓名查询;(1).学号查询:"; cin>>z;
      while(z!='0'&&z!='1')
      {
      cout<<"指令错误<请选择(0)或者(1)!>!!!!!!!"<  cout<<"请选择查询方式:(0).姓名查询;(1).学号查询:"; cin>>z;
      }
      switch(z)
      {
      case '0': search1(head);break;//按姓名查询
      case '1': search2(head);break;//按学号查询
      }
      cout<<"********************************************************************************\n";
      display();
      break;
      }
      case '2': cout<<"******************************现在进行信息修改******************************\n";
      change(head);
      cout<<"********************************************************************************\n";
      display(); break; //按姓名修改
      case '3': cout<<"******************************现在进行信息删除******************************\n";
      shanchu(head);
      show(head);
      cout<<"********************************************************************************\n";
      display();
      break; //删除
      case '4': cout<<"******************************现在进行显示信息******************************\n";
      show(head);
      cout<<"********************************************************************************\n";
      display();
      break; //显示
      case '5':cout<<"******************************现在进行初始化信息****************************\n";
      chushihua(head);
      cout<<"********************************************************************************\n";
      display() ;
      break;
      case '6':cout<<"******************************现在进行提取信息******************************\n";
      get(head);
      cout<<"********************************************************************************\n";
      display(); break;
      case '7':cout<<"******************************现在进行保存信息******************************\n";
      readin(head);
      cout<<"********************************************************************************\n";
      display();
      break;
      case '8':
      cout<<"********************************************************************************\n";
      cout<<" ¤ 您已退出信息管理系统, 谢谢您的使用! ¤ \n";
      cout<<"********************************************************************************\n";
      cout<  exit(0);
      break;
      }
      }while(flag2==1);
      }
      /////////////////////////////////*显示菜单*////////////////////////////////////////
      void display()
      {
      cout<<" ++++++++++**********++++++++++**********++++++++++\n";
      cout<<" $ 菜 单 $\n";
      cout<<" $ ^^^^^^^^^^ $\n";
      cout<<" $ 请选择: $\n";
      cout<<" $ [0]-录入; [1]-查询; [2]-修改; $\n";
      cout<<" $ [3]-删除; [4]-显示; [5]-初始化; $\n";
      cout<<" $ [6]-提取; [7]-保存; [8]-退出; $\n";
      cout<<" **********++++++++++**********++++++++++**********\n";
      cout<<" 请选择相应的数字进行作: ";
      }
      /////////////////////////////////*初始化*////////////////////////////////////////
      void chushihua(student *head)
      {
      int j=0;char c;
      cout<<"注意:初始化作将删除<信息.txt>文件中的所有信息!!!!!!\n";
      cout<<"是否继续作?(y/n):";cin>>c;
      if (c='y')
      {
      amount=1;
      file[j]=new ofstream("D:\\课设\\信息.txt",ios::out);
      }
      cout<<"......成功清除<信息.txt>的信息\n ";
      }
      /////////////////////////////////*显示*////////////////////////////////////////
      void show(student *head)
      {
      student *stu=head;
      cout<<"| 学号 | | 姓名 | 学院 | 专业 | 班级 | 导师 | 论文 | 成绩|"<  while(stu->next!=NULL)
      {

      stu=stu->next;
      cout<<"| "<  cout<<"| "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<"|"<  }
      }
      /////////////////////////////////*保存*////////////////////////////////////////
      void readin(student *head)
      {
      char a;
      student *stu=head->next;
      cout<<"现在保存输入,是否继续作?(y/n)";
      cin>>a;
      ofstream outfile("D:\\课设\\信息.txt",ios::out);
      if(! outfile)
      {
      cout<<"打开文件错误!!!!!!!\n";
      exit(0);
      }
      while(a!='n')
      {
      while(stu!=NULL)
      { outfile<<"************************第"<  outfile<
      outfile<<" 信息: \n"
      <<" | "<  " | "<  <<" | "<  amount++;
      num++;
      (*stu).id=num;
      stu=stu->next;
      }
      break;
      }
      cout<<"......成功将保存到<信息.txt>中! ";
      outfile.close();
      }
      /////////////////////////////////*录入*////////////////////////////////////////
      void input(student *head)
      {
      char c;
      int j=0;
      student *p=head;
      file[j]=new ofstream("D:\\课设\\信息.txt",ios::app);
      do
      {
      student *stu=new student;
      (*stu).id=num+1;
      num++;
      cout<<"请输入(本科,硕士研究生,博士研究生,第二等):"<>(*stu).mun;
      cout<<"请输入姓名:"<>(*stu).name;
      cout<<"请输入该生所在学院:"<  cin>>(*stu).sc3.yw;
      cout<<"请输入该生所在专业:"<  cin>>(*stu).sc3.sx;
      cout<<"请输入该生所在班级):"<  cin>>(*stu).sc3.yy;
      cout<<"请输入该生导师姓名:"<  cin>>(*stu).sc3.wl;
      cout<<"请输入该生论文标题:"<  cin>>(*stu).sc3.hx;
      cout<<"请输入该生加权成绩:"<  cin>>(*stu).sc3.sw;

      stu->next=p->next;
      p->next=stu;
      amount++;
      cout<<"录入成功,想继续录入吗(y/n)"; cin>>c;
      p=p->next;
      while(c!='y'&&c!='n')
      {
      cout<<"指令错误<请输入y/n!>!!!!!!"<  cout<<"录入成功,想继续录入吗(y/n)";
      cin>>c;
      }
      }while(c=='y');
      j++;
      cout<<"输入了 "<  }
      /////////////////////////////////*使用姓名查询*////////////////////////////////////////
      void search1(student *head)//姓名查询
      {
      char c;
      string name;
      do
      {
      student *stu=head->next;
      bool flag=0;
      cout<<"请输入你要查询的姓名:";
      cin>>name;
      do{
      if(stu!=NULL&&name==(*stu).name) //输出总成绩
      {
      flag=1;
      cout<<"您要查询的是:"<name<  cout<<"| 学号 | | 姓名 | 学院 | 专业 | 班级 | 导师 | 论文 |成绩|"<  cout<<"| "<  cout<<"| "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  }
      stu=stu->next;
      }while(stu!=NULL);
      if(flag==0)
      cout<<"对不起!您要查询的不存在!!!!!!!"<  cout<<"您想继续查询吗?(y/n)"; cin>>c;
      while(c!='y'&&c!='n')
      {
      cout<<"指令错误<请输入y/n!>!!!!!!!"<  cout<<"您想继续查询吗?(y/n)"; cin>>c;
      }
      } while(c=='y');
      }
      /////////////////////////////////*用学号查询*////////////////////////////////////////
      void search2(student *head)//学号查询
      {
      char c;int no;
      do
      {
      student *stu=head->next;
      int flag=0;
      cout<<"请输入你要查询的学号:";
      cin>>no;
      do
      {
      if(stu!=NULL&&no==(*stu).id)
      {
      flag=1;
      cout<<"您要查询的是:"<name<  cout<<"| 学号 | | 姓名 | 学院 | 专业 | 班级 | 导师 | 论文 |成绩|"<  cout<<"| "<  cout<<"| "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<"|"<  }
      stu=stu->next;
      }while(stu!=NULL);
      if(flag==0)
      cout<<"对不起!您要查询的不存在!!!!!!!"<  cout<<"您想继续查询吗?(y/n)";
      cin>>c;
      while(c!='y'&&c!='n')
      {
      cout<<"指令错误<请输入y/n!>!!!!!!!"<  cout<<"您想继续查询吗?(y/n)"<  cin>>c;
      }
      }while(c=='y');
      }
      /////////////////////////////////*修改*////////////////////////////////////////
      void change(student *head)
      {
      string name; char c;
      do
      {
      bool flag2=0;
      student *stu=head ;
      info sc3;
      string mu;
      cout<<"请输入您要修改的的姓名:";
      cin>>name;
      do
      {
      if(name==(*stu).name)
      {
      flag2=1;
      cout<<"请输入新信息:";
      cin>>mu;
      cout<<"请输入新学院信息:";
      cin>>sc3.yw;
      cout<<"请输入新专业信息:";
      cin>>sc3.sx;
      cout<<"请输入新班级信息:";
      cin>>sc3.yy;
      cout<<"请输入新导师信息:";
      cin>>sc3.wl;
      cout<<"请输入新论文信息:";
      cin>>sc3.hx;
      cout<<"请输入新加权成绩信息:";
      cin>>sc3.sw;

      (*stu).mun=mu;
      (*stu).sc3.yw=sc3.yw;
      (*stu).sc3.sx=sc3.sx;
      (*stu).sc3.yy=sc3.yy;
      (*stu).sc3.wl=sc3.wl;
      (*stu).sc3.hx=sc3.hx;
      (*stu).sc3.sw=sc3.sw;
      cout<<"| 学号 | | 姓名 | 学院 | 专业 | 班级 | 导师 | 论文 | 成绩 |"<  cout<<"| "<  cout<<"| "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<" | "<  cout<<"|"<  cout<<".......修改成功!\n";
      break;
      }
      stu=stu->next;
      }while(stu!=NULL);
      if(flag2==0)
      {
      cout<<"对不起!您要修改的不存在!请检查重新输入!!!!!!!"<  }
      cout<<"想继续修改吗?(y/n)";
      cin>>c;
      if(c!='y'&&c!='n')
      {
      cout<<"指令错误!请重新输入!!!!!!!";
      cin>>c;
      }
      }while(c=='y');

      }
      /////////////////////////////////*删除*////////////////////////////////////////
      void shanchu(student *head)//学号
      {
      char c;int no;
      do
      {
      int flag=0;
      cout<<"请输入你要删除的学号:";
      cin>>no;

      student *q,*p;
      q=head;
      while(q->next!=NULL&&q->next->id!=no)
      q=q->next;
      if(q->next!=NULL)
      {
      flag=1;
      p=q->next;
      q->next=q->next->next;
      amount--;
      free(p);
      cout<<"......成功删除! ";
      }
      if(flag==0)
      cout<<"对不起!您要删除的不存在!!!!!!!"<  cout<<"您想继续删除吗?(y/n)";
      cin>>c;
      while(c!='y'&&c!='n')
      {
      cout<<"指令错误<请输入y/n!>!!!!!!!"<  cout<<"您想继续删除吗?(y/n)";
      cin>>c;
      }
      }while(c=='y');
      }/////////////////////////////////*提取*////////////////////////////////////////
      void get(student *head)
      {
      student *p;
      p=head;
      int j=0;
      string no;
      cout<<"请输入您想提取的学号前7位:";
      cin>>no;
      string aa;
      aa=int_char(p->next->id);
      while(p->next!=NULL)
      {
      if(no==aa.substr(0,7))
      {
      cout<<"管理系统有您要提取的信息!"<  j=1;
      }
      else p=p->next;
      if(j==1)
      break;
      }
      if(j==1)
      {
      int c,m=0;
      string b,b1,e,infoma[6]={"xueyuan","zhuanye","banji","daoshi","lunwen","jiaquan"};
      string kemu[6]={"学院","专业","班级","导师","论文","加权"};
      cout<<"输入您想提取的信息代:"<  cout<<"1-->学院 2-->专业 3-->班级"<  cout<<"4-->导师 5-->论文 6-->加权"<  cout<<"选择:"; cin>>c;
      string cla="class";
      e=no.substr(6,1);
      b1=cla+e;
      b=b1+infoma[c-1];
      char *f=new char[20];
      for(int i=0;i<20;i++)
      f[i]=b[i];
      f=strcat(f,".txt");
      ofstream outfile(f,ios::out);
      if(! outfile)
      {
      cout<<"打开错误!!!!!!!"<  exit(1);
      }
      outfile<<"\t您要提取的信息\t\t\t"<  outfile<<" -----------------------------"<  outfile<<"| 学号 | 姓名 | ";
      outfile<  while(p->next!=NULL)
      {
      outfile<<" -----------------------------"<  outfile<<"|"<next->id<<" | "<next->name<<" |";
      switch(c)
      {
      case 1:outfile<next->sc3.yw<<" |";
      outfile<  break;
      case 2:outfile<next->sc3.sx<<" |";
      outfile<  break;
      case 3:outfile<next->sc3.yy<<" |";
      outfile<  break;
      case 4:outfile<next->sc3.wl<<" |";
      outfile<  break;
      case 5:outfile<next->sc3.hx<<" |";
      outfile<  break;
      case 6:outfile<next->sc3.sw<<" |";
      outfile<  break;
      }
      p=p->next;
      }
      outfile<<" -----------------------------"<  outfile.close();
      cout<<"......已经保存在"<  }
      if(j==0)
      cout<<"管理系统中没有您要提取的!!!!!!!!"<
      }
      string int_char(int)
      {

      int a,b,i;
      char c[10];
      cin>>b;
      for(i=0;i<9;i++)
      {
      a=b%10;
      b=b/10;
      c[8-i]=a+'0';
      }
      c[9]='\0';
      return c;

      }

    浏览 343赞 91时间 2023-12-12
  • iamYolandaXYZ

    建议你到 “ 大部落 ” 论文设计管理系统参考一下!

    浏览 220赞 90时间 2021-10-21

学生毕业设计管理系统一、设计项目:完成学生毕业设计管理系统