⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 学籍管理系统文档c++代码.txt

📁 实现学籍管理系统的c++源代码,包含输入
💻 TXT
📖 第 1 页 / 共 2 页
字号:
#include"学籍管理.h"
extern student i[1000];
extern course  j[8];
 void fn1()
{
	
	static int h;
	cout<<"欢迎进入数据输入系统."<<endl;
	ofstream file1("d:\\student.txt",ios::ate );
	for(;;h++)
	{
		cout<<"请输入学号:";
		cin>>i[h].code;
		cout<<endl;
		cout<<"请输入姓名:";
		cin>>i[h].p;
		cout<<endl;
		cout<<"请输入性别:";
		cin>>i[h].q;
		cout<<endl;
		cout<<"请输入年龄:";
		cin>>i[h].age;
		cout<<endl;
		cout<<"请输入家庭住址:";
		cin>>i[h].w;
		cout<<endl;
		file1<<setw(10)<<i[h].code<<setw(10)<<i[h].p<<setw(10)<<i[h].q
			<<setw(10)<<i[h].age<<setw(30)<<i[h].w<<endl;
a:	cout<<"继续,输入1;退出,输入2"<<endl;
		int n;
		cin>>n;
		if(n==1)
			;
		else if(n==2)
		{
			cout<<"你已经退出了信息录入系统"<<endl;
			break;
		}
		else
		{
			cout<<"对不起,你输入有误,请重新选择.";
			goto a;
		
		}
	}
	ofstream file8("d:\\xuehao.txt",ios::out);
	file8<<(h+1);
}
void  fn2()
{
	course j[8];

	static int kmmm;
	cout<<"欢迎进入录入课程表系统!!"<<endl;
	cout<<"本系统由于简陋,请一次输入八个学期课程,并请输入着小心谨慎!!!"<<endl;
	ofstream file2("d:\\course.txt",ios::ate);
	ifstream file8("d:\\kecheng.txt",ios::nocreate);
		file8>>kmmm;
	for(;kmmm<8;kmmm++)
	{
		cout<<"请输入你要输入的学期数(注意:请从第一学期开始,按顺序输入)"<<endl;
		int lr;
		cin>>lr;
      ofstream file3; 
    switch (lr)
	{
	 case 1:
		 {
		file3.open("d:\\course1.txt");
		break;
		 }
   	case 2:
		{
		file3.open("d:\\course2.txt");
		break;
		}
	case 3:
		{
			 file3.open("d:\\course3.txt");
			break;
		}

	case 4:
		{
		 file3.open("d:\\course4.txt");
		break;
		}

	case 5:
		{
	    file3.open("d:\\course5.txt");
      	break;
		}

	case 6:
		{
		 file3.open("d:\\course6.txt");
		break;
		}

	case 7:
		{
		 file3.open("d:\\course7.txt");
		break;
		}

	case 8:
		{
		    file3.open("d:\\course8.txt");
		    break;
		}
	}
		cout<<"请输入课程总数:"<<endl;
		cin>>j[lr].c;
			file3<<lr<<"   "<<j[lr].c;
		for(int kech=0;kech<j[lr].c;kech++)
		{
			cout<<"请输入第"<<kech+1<<"门课程"<<endl;
			cin>>j[lr].yy[kech];
			file3<<"   "<<j[lr].yy[kech];
		}
		file3<<endl;
		b:	cout<<"继续,输入1;退出,输入2"<<endl;
		int n;
		cin>>n;
		if(n==1)
			;
		else if(n==2)
		{
			cout<<"你已经退出课程录入系统"<<endl;
			break;
		}
		else
		{
			cout<<"对不起,你输入有误,请重新选择.";
			goto b;
		}
	}
}


void fn3()
{

	cout<<"欢迎进入成绩录入系统!!!"<<endl;
	ifstream file1("d:\\student.txt",ios::nocreate);
	cout<<"本成绩录入系统太简陋,录入时请小心翼翼!!!"<<endl;
	cout<<"请输入那一学期的成绩录入."<<endl;
	int lr;
	cin>>lr;
	cout<<endl;
	cout<<endl;
    ofstream file3; 
switch (lr)
{
	case 1:
	{
		file3.open("d:\\score1.txt",ios::ate);
		break;
	}
	case 2:
	{
		file3.open("d:\\score2.txt",ios::ate);
		break;
	}
	case 3:
		{
			 file3.open("d:\\score3.txt",ios::ate);
			break;
		}

	case 4:
	{
		 file3.open("d:\\score4.txt",ios::ate);
		break;
	}

	case 5:
	{
	    file3.open("d:\\score5.txt",ios::ate);
      	break;
	}

	case 6:
	{
		 file3.open("d:\\score6.txt",ios::ate);
		break;
	}

	case 7:
	{
		 file3.open("d:\\score7.txt",ios::ate);
		break;
	}

	case 8:
		{
		    file3.open("d:\\score8.txt",ios::ate);
		    break;
		}
	}
     ifstream file4;
     switch(lr)
	 {
	 case 1:
		 {
			 file4.open("d:\\course1.txt",ios::nocreate);
			 break;
		 }
	 case 2:
		 {
			 file4.open("d:\\course2.txt",ios::nocreate);
			 break;
		 }
	 case 3:
		 {
			 file4.open("d:\\course3.txt",ios::nocreate);
			 break;
		 }
	 case 4:
		 {
			 file4.open("d:\\course4.txt",ios::nocreate);
			 break;
		 }
	 case 5:
		 {
			 file4.open("d:\\course5.txt",ios::nocreate);
			 break;
		 }
	 case 6:
		 {
			 file4.open("d:\\course6.txt",ios::nocreate);
			 break;
		 }
	 case 7:
		 {
			 file4.open("d:\\course7.txt",ios::nocreate);
			 break;
		 }
	 case 8:
		 {
			 file4.open("d:\\course8.txt",ios::nocreate);
			 break;
		 }
	 }
	 file4>>j[lr].x>>j[lr].c;
	 for(int mm3=0;mm3<j[lr].c;mm3++)
        file4>>j[lr].yy[mm3];
	cout<<"请输入每个人的各科目成绩(请一次输完)"<<endl;	
	cout<<setw(10)<<"学号"<<setw(10)<<"姓名";
	cout<<endl;
	for( int lz1=0;lz1<100;lz1++)
	   file1>>i[lz1].code>>i[lz1].p>>i[lz1].q>>i[lz1].age>>i[lz1].w;
	for( int lz=0;lz<100;lz++)
	{
		cout<<setw(10)<<i[lz].code<<setw(10)
			<<i[lz].p;
		for(int mm1=0;mm1<j[lr].c;mm1++)
		{	
			cout<<j[lr].yy[mm1]<<"的成绩是:"<<endl;
		    cin>>setw(15)>>i[lz].zz[mm1];
			cout<<endl;
			file3<<setw(10)<<i[lz].zz[mm1];
		}
		file3<<endl;
		cout<<endl;
        
cc:	cout<<"继续,输入1;退出,输入2"<<endl;
		int n;
		cin>>n;
		if(n==1)
			;
		else if(n==2)
		{
			cout<<"你已经退出成绩录入系统"<<endl;
			break;
		}
		else
		{
			cout<<"对不起,你输入有误,请重新选择.";
			goto cc;
		}
	}

} 
void fn4()
{
     cout<<"欢迎进入成绩查询系统!!"<<endl;
ch: cout<<"如果你用姓名查询,请输入1;如果你用学号查询,请输入2"<<endl;
     ifstream file1("d:\\student.txt",ios::nocreate);
     int n;
     cin>>n;
     cout<<"请输入你要查哪一个学期的成绩:"<<endl;
     int m;
     cin>>m;
	 ifstream file3;
     switch(m)
	 {
	 case 1:
		 {
			 file3.open("d:\\score1.txt",ios::nocreate);
			 break;
		 }
	 case 2:
		 {
			 file3.open("d:\\score2.txt",ios::nocreate);
			 break;
		 }
	 case 3:
		 {
			 file3.open("d:\\score3.txt",ios::nocreate);
			 break;
		 }
	 case 4:
		 {
			 file3.open("d:\\score4.txt",ios::nocreate);
			 break;
		 }
	 case 5:
		 {
			 file3.open("d:\\score5.txt",ios::nocreate);
			 break;
		 }
	 case 6:
		 {
			 file3.open("d:\\score6.txt",ios::nocreate);
			 break;
		 }
	 case 7:
		 {
			 file3.open("d:\\score7.txt",ios::nocreate);
			 break;
		 }
	 case 8:
		 {
			 file3.open("d:\\score8.txt",ios::nocreate);
			 break;
		 }
	 }

ifstream file4;
     switch(m)
	 {
	 case 1:
		 {
			 file4.open("d:\\course1.txt",ios::nocreate);
			 break;
		 }
	 case 2:
		 {
			 file4.open("d:\\course2.txt",ios::nocreate);
			 break;
		 }
	 case 3:
		 {
			 file4.open("d:\\course3.txt",ios::nocreate);
			 break;
		 }
	 case 4:
		 {
			 file4.open("d:\\course4.txt",ios::nocreate);
			 break;
		 }
	 case 5:
		 {
			 file4.open("d:\\course5.txt",ios::nocreate);
			 break;
		 }
	 case 6:
		 {
			 file4.open("d:\\course6.txt",ios::nocreate);
			 break;
		 }
	 case 7:
		 {
			 file4.open("d:\\course7.txt",ios::nocreate);
			 break;
		 }
	 case 8:
		 {
			 file4.open("d:\\course8.txt",ios::nocreate);
			 break;
		 }
	 }
	 file4>>j[m].x>>j[m].c;
	 for(int cs=0;cs<j[m].c;cs++)
         file4>>j[m].yy[cs];
	 for(int xh=0;xh<100;xh++)
	 {
		 file1>>i[xh].code>>i[xh].p>>i[xh].q>>i[xh].age>>i[xh].w;
         for(int zj=0;zj<j[m].c;zj++)
	        file3>>i[xh].zz[zj];
	 }
     if(n==1)
	 { 
       cout<<"请输入你要查询人的姓名:"<<endl;
       char*name=new char[54];
       cin>>name;
       cout<<setw(20)<<"学号"<<setw(20)<<"姓名";
       for(int xq=0;xq<j[m].c;xq++)
          cout<<setw(20)<<j[m].yy[xq];
       cout<<endl;
	   int mm=0;
	   for(int yd=0;yd<100;yd++)
	   {
		   if(strcmp(name,i[yd].p)==0)
		 {  
			 
             cout<<setw(20)<<i[yd].code<<setw(20)<<i[yd].p;
                   for(int hh=0;hh<j[m].c;hh++)
                         cout<<setw(20)<<i[yd].zz[hh];
              cout<<endl;
			  mm++;
         }
		 else
			 ;
	   }
		 if(mm=0)
			 cout<<"没有该人的成绩"<<endl;
		 else
			 ;
	 }
  else if(n==2)
    {
gg: cout<<"请输入你要查询的学号:"<<endl;
            long int  xuehao;
            cin>>xuehao;
          
   
           if(xuehao<98101||xuehao>99101)
            {         
                 cout<<"对不起你的输入有误,请重新输入:"<<endl;
                  goto gg;
             }
		   else
		   {
			   long int o;
			   o=(xuehao-98101);
                cout<<setw(20)<<"学号"<<setw(20)<<"姓名";
                for(int xq=0;xq<j[m].c;xq++)
                cout<<setw(20)<<j[m].yy[xq];
                cout<<endl;
                cout<<setw(20)<<i[o].code<<setw(20)<<i[o].p;
                for(int cs1=0;cs1<j[m].c;cs1++)
                   cout<<setw(20)<<i[o].zz[cs1];
                cout<<endl; 
		   }
            
     }
  else 
  {
	  cout<<"对不起,输入有误!请重新选择查询方式."<<endl;
	  goto ch;
  }
  
}
void fn5()
{
     cout<<"欢迎进入分数修改系统."<<endl;
     cout<<"修改本系统的数据时,请仔细查看!!!!!"<<endl;
     cout<<"由于有重名的现象,所以本系统只能通过学号查询!!"<<endl;
    chongxin: cout<<"请输入该学生的学号"<<endl;
      long int xuehao;
     cin>>xuehao;
     cout<<"请输入你想修改那一学期的成绩:"<<endl;
     int term;
     cin>>term;
     cout<<"请输入第"<<term<<"学期的课程数目:"<<endl;
     int kecheng;
     cin>>kecheng;
      ifstream file1("d:\\student.txt",ios::nocreate);
      ifstream file2("d:\\course.txt",ios::nocreate);
      ofstream  file3;
     switch(term)
          { 
               case 1:
		 {
			 file3.open("d:\\score1.txt",ios::ate);
			 break;
		 }
	 case 2:
		 {
			 file3.open("d:\\score2.txt",ios::ate);
			 break;
		 }
	 case 3:
		 {
			 file3.open("d:\\score3.txt",ios::ate);
			 break;
		 }
	 case 4:
		 {
			 file3.open("d:\\score4.txt",ios::ate);
			 break;
		 }
	 case 5:
		 {
			 file3.open("d:\\score5.txt",ios::ate);
			 break;
		 }
	 case 6:
		 {
			 file3.open("d:\\score6.txt",ios::ate);
			 break;
		 }
	 case 7:
		 {
			 file3.open("d:\\score7.txt",ios::ate);
			 break;
		 }
	 case 8:
		 {
			 file3.open("d:\\score8.txt",ios::ate);
			 break;
		 }
            }
       cout<<"请输入该课程在成绩表中是第几门课程"<<endl;
       int name;
       cin>>name;
	   for(int aa=0;aa<1000;aa++)
	   {
		   file1>>i[aa].code>>i[aa].p>>i[aa].q>>i[aa].age>>i[aa].w;
		   for(int pp=0;pp<kecheng;pp++)
		     file1>>i[aa].zz[pp];
	   }
	   long int o;
	   o=xuehao-98101;
       cout<<"请输入你要修改的成绩"<<endl;
        float chengji;
        cin>>chengji;
        i[o].zz[name]=chengji;
    ofstream  file4;
     switch(term)
          { 
               case 1:
		 {
			 file4.open("d:\\score1.txt",ios::trunc);
			 break;
		 }
	 case 2:
		 {
			 file4.open("d:\\score2.txt",ios::trunc);
			 break;
		 }
	 case 3:
		 {
			 file4.open("d:\\score3.txt",ios::trunc);
			 break;
		 }
	 case 4:
		 {
			 file4.open("d:\\score4.txt",ios::trunc);
			 break;
		 }
	 case 5:
		 {
			 file4.open("d:\\score5.txt",ios::trunc);
			 break;
		 }
	 case 6:
		 {
			 file4.open("d:\\score6.txt",ios::trunc);
			 break;
		 }
	 case 7:
		 {
			 file4.open("d:\\score7.txt",ios::trunc);
			 break;
		 }
	 case 8:
		 {
			 file4.open("d:\\score8.txt",ios::trunc);
			 break;
		 }
            }
		for(int aa1=0;aa1<1000;aa1++)
		{
			for(int pp1=0;pp1<10;pp1++)
			 file3<<i[aa1].zz[pp1];
			file3<<endl;
		}	
        cout<<"修改以后的成绩为:"<<endl;
         cout<<chengji;
         cout<<"如果正确请输入1;错误请输入2(输入正确系统就会自动退出)"<<endl;
        int number;
          cin>>number;
           if(number==1)
             cout<<"你已经退出系统了"<<endl;
           else
              {
                 cout<<"重新输入吧!!!"<<endl;
                  goto chongxin;
               }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -