#include<iostream> #include<vector> #include<windows.h> using namespace std; int a=999; struct student{ string name; int age; int card; int croom; }s; void xitong(){ cout<<"学生管理系统:"<<endl; cout<<"1.新建学生信息"<<endl; cout<<"2.查找学生信息"<<endl; cout<<"3.修改学生信息"<<endl; cout<<"4.删除学生信息"<<endl; cout<<"5.退出系统"<<endl; } void chazhao(){ 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.croom; cout<<"你的学号是:"; a++; s.card=a; cout<<s.card; v.push_back(s); Sleep(500); } vector<student> insert2(vector<student> v){ cout<<"---------------------"<<endl; while(1){ chazhao(); int a; cin>>a; if(a==5){ break; } switch(a){ case 1: cout<<"请输入你要查询的学号"; } } } int main(){ vector<student> v; while(1){ xitong(); int n; cin>>n; if(n==5){ break; } switch(n){ case 1:{ v=insert(v); break; } case 2:{ v=insert2(v); break; } case 3:{ break; } case 4:{ break; } default:{ break; } } system("cls"); } return 0; }
标签:case,容器,饭卡,cout,int,break,croom,include From: https://www.cnblogs.com/boyeyuan/p/17922280.html