c++学生系统(已更新)

#include
#include
using namespace std;
string xue[5001],xingbie[5001];
long int xuehao[5001],jifen[5001],zhan=0;
string shang[5001];
long int jiage[5001],sz=0;
int read()
{
    char ch=_getch();
    while(ch>'9'||ch<'0') ch=_getch();
    return ch-48;
}
void Read(){
    ifstream in("学生档案.txt");
    in>>zhan;
    for(int i=1;i<=5000;i++) in>>xue[i]>>xingbie[i]>>xuehao[i]>>jifen[i];
    in>>sz;
    for(int i=1;i<=5000;i++) in>>shang[i]>>jiage[i];
    in.close();}
void Save(){
    ofstream out("学生档案.txt");
    out<xuehao[j+1])
			{
				swap(jifen[j],jifen[j+1]);
				swap(xuehao[j],xuehao[j+1]);
				swap(xingbie[j],xingbie[j+1]);
				swap(xue[j],xue[j+1]);
			}
		 } 
	}
	for(int i=1;i<=zhan;i++)
	{
		cout<<"学号:"<>gezhengxu2024;
		system("cls");
		if(gezhengxu2024==1)
		{
			while(1)
			{
				system("cls");
				cout<<"1:添加学生(删除在学生档案中自己手动删)\n2:学号排序\n3:积分排序\n4:添加积分\n5:减去积分\n6:查找学号\n7:课后评价\n8:退到主页\n9:彻底退出";
				long int s;
				cin>>s;
				system("cls");
				if(s==5)
				{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				cout<<"1:学号减去\n2:姓名减去\n";
				long int jinitaimei;
				cin>>jinitaimei;
				if(jinitaimei==1)
				{
					cout<<"请输入学号和要减去的积分:\n";
					long int xh,jf;
					cin>>xh>>jf;
					for(int i=1;i<=zhan;i++)
					{
						if(xuehao[i]==xh)
						{
							jifen[i]-=jf;
							cout<<"减去成功!";
							Save();
							system("pause");
							continue;  
						}
					}
				}
				else if(jinitaimei==2)
				{
					cout<<"请输入姓名和要减去的积分:\n";
					long int jf;
					string xm;
					cin>>xm>>jf; 
					for(int i=1;i<=zhan;i++)
					{
						if(xue[i]==xm)
						{
							jifen[i]+=jf;
							cout<<"减去成功!"; 
							Save();
							system("pause");
							continue; 
						}
					}
				}
			}
			if(s==7)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				cout<<"1:学号添加\n2:姓名添加\n";
				long int jinitaimei;
				cin>>jinitaimei;
				if(jinitaimei==1)
				{
					cout<<"请输入学号:\n";
					long int xh;
					cin>>xh;
					int c,d,e,f,g,h,z=0;
					printf("学习态度:");
					c=read();
					printf("\n知识掌握:");
					d=read();
					printf("\n应用测评:");
					e=read();
					printf("\n座位整洁:");
					g=read();
					printf("\n签到:");
					f=read();
					if(f==3)
					{
						z+=30;
						Save();
					}
					else if(f==2)
					{
						z+=10;
						Save();
					}
					else if(f==1)
					{
						z+=0;
						Save();
					}
					if(g==5)
					{
						z+=10;
						Save();
					}
					h=c+d+e;
					h/=3;
					if(h==5)
					{
						z+=50;
						Save();
					}
					else if(h==4)
					{
						z+=10;
						Save();
					}
					else if(h<=3)
					{
						z+=0;
						Save();
					}
					for(int i=1;i<=zhan;i++)
					{
						if(xuehao[i]==xh)
						{
							jifen[i]+=z;
							cout<<"添加成功!";
							Save();
							system("pause");
							continue;  
						}
					}
				}
				else if(jinitaimei==2)
				{
					cout<<"请输入姓名:\n";
					string xm;
					cin>>xm; 
					int c,d,e,f,g,h,z=0;
					printf("学习态度:");
					c=read();
					printf("\n知识掌握:");
					d=read();
					printf("\n应用测评:");
					e=read();
					printf("\n座位整洁:");
					g=read();
					printf("\n签到:");
					f=read();
					if(f==3)
					{
						z+=30;
						Save();
					}
					else if(f==2)
					{
						z+=10;
						Save();
					}
					else if(f==1)
					{
						z+=0;
						Save();
					}
					if(g==5)
					{
						z+=10;
						Save();
					}
					h=c+d+e;
					h/=3;
					if(h==5)
					{
						z+=50;
						Save();
					}
					else if(h==4)
					{
						z+=10;
						Save();
					}
					else if(h<=3)
					{
						z+=0;
						Save();
					}
					for(int i=1;i<=zhan;i++)
					{
						if(xue[i]==xm)
						{
							jifen[i]+=z;
							cout<<"添加成功!"; 
							Save();
							system("pause");
							continue; 
						}
					}
				}
				else
				{
					printf("无用数字!");
					system("pause");
					continue; 
				}
			}
			else if(s==8)
			{
				system("cls");
				break;
			}
			else if(s==9)
			{
				printf("退出成功!");
				Save();
				return 0; 
			}
			else if(s==1)
			{
				if(zhan==5000)
				{
					printf("学生已到5000人极限,无法添加!");
					system("pause");
					continue; 
				}
				zhan++;
				cout<<"请输入姓名:"; 
				cin>>xue[zhan];
				cout<<"请输入性别:";
				cin>>xingbie[zhan];
				cout<<"请输入学号:";
				cin>>xuehao[zhan];
				if(zhan!=1)
				{
					if(xc(xue[zhan])&&xhc(xuehao[zhan]))
					{
						cout<<"添加成功!";
					}
					else
					{
						cout<<"添加失败!";
						system("pause");
						zhan--;
						continue;
					}
				}
				else cout<<"添加成功!";
				system("cls");
				Save();
			}
			else if(s==2)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				else if(zhan==1)
				{
					cout<<"你就一个,排什么排!!!!!!";
					system("pause");
					continue; 
				}
				paixuehao();
			}
			else if(s==3)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				else if(zhan==1)
				{
					cout<<"你就一个,排什么排!!!!!!";
					system("pause");
					continue; 
				}
				paijifen();
			}
			else if(s==4)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				cout<<"1:学号添加\n2:姓名添加\n";
				long int jinitaimei;
				cin>>jinitaimei;
				if(jinitaimei==1)
				{
					cout<<"请输入学号和要添加的积分:\n";
					long int xh,jf;
					cin>>xh>>jf;
					for(int i=1;i<=zhan;i++)
					{
						if(xuehao[i]==xh)
						{
							jifen[i]+=jf;
							cout<<"添加成功!";
							Save();
							system("pause");
							continue;  
						}
					}
				}
				else if(jinitaimei==2)
				{
					cout<<"请输入姓名和要添加的积分:\n";
					long int jf;
					string xm;
					cin>>xm>>jf; 
					for(int i=1;i<=zhan;i++)
					{
						if(xue[i]==xm)
						{
							jifen[i]+=jf;
							cout<<"添加成功!"; 
							Save();
							system("pause");
							continue; 
						}
					}
				}
				else
				{
					printf("无用数字!");
					system("pause");
					continue; 
				}
			}
			else if(s==6)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				cout<<"请输入姓名:";
				string xm;
				cin>>xm;
				for(int i=1;i<=zhan;i++)
				{
					if(xue[i]==xm) 
					{
						cout<>s;
			system("cls");
			if(s==1)
			{
				if(zhan==0) 
				{
					cout<<"你没学生!!!!!";
					system("pause");
					continue; 
				}
				if(sz==0)
				{
					cout<<"你没商品!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
					system("pause");
					continue; 
				}
				cout<<"1:学号购买\n2:姓名购买\n";
				long int jinitaimei;
				cin>>jinitaimei;
				if(jinitaimei==1)
				{
					cout<<"请输入学号:\n";
					long int xh;
					cin>>xh;
					system("cls");
					long int c,z=0;
					cout<<"商品:\n"; 
					for(int i=1;i<=sz;i++)
						cout<>c;
					z=jiage[c];
					for(int i=1;i<=zhan;i++)
					{
						if(xuehao[i]==xh)
						{
							if(jifen[i]-z>=0)
							{
								jifen[i]-=z;
								cout<<"购买成功!";
								Save();
								system("pause");
								continue;  
							}
							else
							{
								cout<<"购买失败!";
								system("pause");
								continue;
							}
						}
					}
				}
				else if(jinitaimei==2)
				{
					cout<<"请输入姓名:\n";
					string xm;
					cin>>xm;
					system("cls"); 
					long int c,z=0;
					cout<<"商品:\n"; 
					for(int i=1;i<=sz;i++)
						cout<>c;
					z=jiage[c];
					for(int i=1;i<=zhan;i++)
					{
						if(xue[i]==xm)
						{
							if(jifen[i]-z>=0)
							{
								jifen[i]-=z;
								cout<<"购买成功!";
								Save();
								system("pause");
								continue;  
							}
							else
							{
								cout<<"购买失败!";
								system("pause");
								continue;
							} 
						}
					}
				}
			}
			else if(s==2)
			{
				if(sz==5000)
				{
					printf("商品已到5000极限,无法添加!");
					system("pause");
					continue; 
				}
				sz+=1;
				cout<<"请输入商品名:";
				cin>>shang[sz];
				cout<<"请输入价格:";
				cin>>jiage[sz];
				if(sz!=1)
				{
					if(sc(shang[sz]))
					{
						cout<<"添加成功!";
						system("pause");
						continue;
					}
					else
					{
						cout<<"添加失败!";
						sz-=1;
					}
				}
				else cout<<"添加成功!";
				system("pause");
				Save();
			}
			else if(s==3)
			{
				system("cls");
				break;
			}
			else if(s==4)
			{
				printf("退出成功!");
				Save();
				return 0; 
			}
				}		
		}
		else if(gezhengxu2024==3)
		{
			printf("退出成功!");
			Save();
			return 0; 
		}
		else
		{
			cout<<"无用数字!" ;
			system("pause");
		}
	}
	Save();
	return 0;
 } 

你可能感兴趣的:(c++,系统,c++,算法,开发语言)