昨天我费了一个下午才做出来。
废话少说代码直接出来⇩⇩
#include<iostream> #include<algorithm> #include<string> #include<cstring> #include<cstdio> #include<stdio.h> #include<bits/stdc++.h> #include<conio.h> #include<iostream> #include<windows.h> #include<conio.h> #include<time.h> #include<string> #include <fstream> using namespace std; int cmp(int a,int b){ return a>b; } struct stu{ char name[999]; long long int xh,xb; }; stu xs[9999]; int main(){ system("color f4"); char a[500][500]={" c++系统", "1.同学录入", "2.同学查找", }; long long int n,i=0,j,q,w; for(j=0;j<3;j++){ puts(a[j]); } while(1){ cin>>n; if(n==1){ system("cls"); cout<<"名字:"; cin>>xs[i].name; cout<<endl<<"学号:"; cin>>xs[i].xh; for(q=0;q<i;q++){ if(xs[i].xh==xs[q].xh){ cout<<"学号重复!!"; return 0; } } cout<<endl<<"性别(1男0女)"; cin>>xs[i].xb; i++; cout<<endl<<"录入完成";//ok cout<<endl<<"输入0表示已看完"<<endl; cin>>n; system("cls"); } if(n==2){ system("cls"); cout<<"请输入学号"<<endl;//xh cin>>w; for(q=0;q<i;q++){ if(w==xs[q].xh){ cout<<"名字:"<<xs[q].name; cout<<endl<<" 性别:"; if(xs[q].xb==0){ cout<<"女"<<endl; }else{ cout<<"男"<<endl; } cout<<" 学号:"<<xs[q].xh<<endl; cout<<endl<<"输入0表示已看完"<<endl; cin>>n; break; } } } system("cls"); for(j=0;j<3;j++){ puts(a[j]); } } return 0; }
c++学生录入系统1.0
最新推荐文章于 2024-08-09 10:25:03 发布