首页 > 其他分享 >11111111

11111111

时间:2023-12-29 20:13:51浏览次数:32  
标签:11111111 case cout int break grade switch

#include<iostream>
#include<vector>
#include<windows.h>
using namespace std;
int a=999;
int b=0;
bool c=false;
struct student{
	string name;
	int age;
	int card;
	int grade;
}s;
void ka(){
	cout<<"学生管理系统:"<<endl;
	cout<<"1.新建学生信息"<<endl;
	cout<<"2.查找学生信息"<<endl;
	cout<<"3.修改学生信息"<<endl;
	cout<<"4.删除学生信息"<<endl;
	cout<<"5.退出系统"<<endl;
}
vector<student> insert(vector<student> v){
	cout<<"请输入学生姓名:";
	cin>>s.name;
	cout<<"请输入学生年龄:";
	cin>>s.age;
	cout<<"请输入学生年级:";
	cin>>s.grade;
	cout<<"你的学号是:";
	a++;
	s.card=a;
	cout<<s.card;
	v.push_back(s);
	Sleep(500);
	return v;
}
vector<student> find(vector<student> v){
	while(1){
		cout<<"你要用什么形式查找:"<<endl;
		cout<<"1.学生卡号"<<endl;
		cout<<"2.学生年龄"<<endl;
		cout<<"3.学生姓名"<<endl;
		cout<<"4.退出"<<endl;
		cin>>b;
		if(b==4){
			break;
		}
		switch(b){
		case 1:{
			cin>>b;
			for(int i=0;i<v.size();i++){
				if(v[i].card==b){
					cout<<"学生姓名:";
					cout<<v[i].name<<endl;
					cout<<"请输入学生年龄:";
					cout<<v[i].age<<endl;
					cout<<"请输入学生年级:";
					cout<<v[i].grade<<endl;
					Sleep(2000);
					c=true;
				}
			}
		if(c==false){
			cout<<"没找到";
			Sleep(500);
		}
		break;
		}
		
		
		case 2:{
			cin>>b;
			for(int i=0;i<v.size();i++){
				if(v[i].age==b){
					cout<<"学生姓名:";
					cout<<v[i].name<<endl;
					cout<<"请输入学生年龄:";
					cout<<v[i].age<<endl;
					cout<<"请输入学生年级:";
					cout<<v[i].grade<<endl;
					Sleep(2000);
					c=true;
					}
				}
			if(c==false){
				cout<<"没找到";
				Sleep(500);			
				}
			break;
			}
		case 3:{
		string d;
		cin>>d;
		for(int i=0;i<v.size();i++){
			if(v[i].name.find(d)!=string::npos){
				cout<<"学生姓名:";
				cout<<v[i].name<<endl;
				cout<<"请输入学生年龄:";
				cout<<v[i].age<<endl;
				cout<<"请输入学生年级:";
				cout<<v[i].grade<<endl;
				Sleep(2000);
				c=true;
			}
		}
		if(c==false){
			cout<<"没找到";
			Sleep(500);
		}
		break;
		}
		 
		default :{
		 
		break;
		}
		}
		system("cls");
}
 
	return v;
}
vector<student> change(vector<student> v){
	for(int i=0;i<v.size();i++){
		if(v[i].card==b){
		while(1){
			c=true;
			cout<<"你要修改什么:"<<endl;
			cout<<"1.学生姓名"<<endl;
			cout<<"2.学生年龄"<<endl;
			cout<<"3.学生年级"<<endl;
			cout<<"4.退出"<<endl;
			cin>>b;
			if(b==4){
				break;
			}
		switch(b){
			case 1:{
				cout<<v[i].name<<endl;
				cin>>v[i].name;
				break;
			}
			case 2:{
				cout<<v[i].age<<endl;
				cin>>v[i].age;
				break;
			}
			case 3:{
				cout<<v[i].grade<<endl;
				cin>>v[i].grade;
				break;
			}
		default:{
			
			
		break;
		}
		}
		system("cls");
		}
	 
	}
	}
	if(c==false){
		cout<<"没找到";
		Sleep(500);
	}
	 
	 
	return v;
}
int main(){
	vector<student> v;
	while(1){
		ka();
		int n;
		cin>>n;
		if(n==5){
			break;
		}
	switch(n){
		case 1:{
			v=insert(v);
			break;
		}
		case 2:{
			find(v);
			break;
		}
		case 3:{
			cout<<"请输入学生卡号:";
			cin>>b;
			change(v);
			break;
		}
		case 4:{ 
			break;
		}
	}
		system("cls");
	}
	 
	return 0;
 
}

  

标签:11111111,case,cout,int,break,grade,switch
From: https://www.cnblogs.com/boyeyuan/p/17935608.html

相关文章

  • 111111111111
    ##----------PromptGenModule-----------------------classPromptGenBlock(nn.Module):def__init__(self,prompt_dim=128,prompt_len=5,prompt_size=96,lin_dim=192):super(PromptGenBlock,self).__init__()self.prompt_param=nn.Paramet......
  • 11111111111
    importtorchfromtorchimportnnimportnumpyasnpimportmatplotlib.pyplotaspltfromPILimportImagefromtorchvisionimporttransformsfrommathimportsqrtimportosos.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"#读取两张图像img1=I......
  • 111111111
    33MEHOB8W0-eyJsaWNlbnNlSWQiOiIzM01FSE9COFcwIiwibGljZW5zZWVOYW1lIjoiUG9saXRla25payBNZXJsaW1hdSBNZWxha2EiLCJhc3NpZ25lZU5hbWUiOiJtYWdnaWUgc2VyIiwiYXNzaWduZWVFbWF......
  • [vue项目] 后台管理 11111111111111111
    文章目录​​gitee地址​​​​登录业务解析​​​​退出登录​​​​模板结构图​​​​路由的搭建​​​​品牌管理​​​​table数据渲染​​​​分页器​​​​点击添加......
  • 111111111111111111
    测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测......
  • wireshark 11111111111111111
     wireshark抓包过滤器语法及示例=====================================================================BPF语法(BerkeleyPacketFilter),基于libpcap/wincap库语句......
  • tcpdump 1111111111111111111111111
     tcpdump命令格式、参数====================================================================================================================tcpdump[-AdDe......