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

2025-03-05 09:12:32
推荐回答(2个)
回答1:

  #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;

  }

回答2:

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