-
个人简介
this is 我做的好van的东西
#include<iostream> using namespace std; const int maxn = 114514; struct user{ string name; int dengji; }users[maxn]; int main() { int n , x; cout << "请输入注册用户的数量:"; cin >> n; for(int i = 1;i <= n;i++) { cout << i << "号用户名字:"; cin >> users[i].name; cout << i << "号用户等级:"; cin >> users[i].dengji; } string caozuo; while(true) { cout << "是否退出(是请输入1,否请输入0):"; cin >> caozuo; if(caozuo == "1") { return 0; } cout << "请输入查询用户的号码:"; cin >> x; if(x > n) { cout << "不存在该用户!" << endl; continue; } cout << "该用户名为:" << users[x].name << endl; cout << "该用户等级为:" << users[x].dengji << endl; } }
这个这个这个……还有这个!
#include<bits/stdc++.h> using namespace std; struct student{ string name;//名字 int number;//学号 int Chinese_score;//语文成绩 int maths_score;//数学成绩 int English_score;//英语成绩 int total_score;//总成绩 }students[114514]; int main() { int n; cout << "请输入考生数量:"; cin >> n; for(int i = 1;i <= n;i++) { cout << "请输入" << i << "号考生名字:"; cin >> students[i].name; cout << "请输入" << i << "号考生学号:"; cin >> students[i].number; cout << "请输入" << i << "号考生语文、数学和英语成绩(中间用空格隔开):"; cin >> students[i].Chinese_score >> students[i].maths_score >> students[i].English_score; students[i].total_score = students[i].Chinese_score + students[i].maths_score + students[i].English_score; } while(1) { int caozuo , x; cout << "请输入操作(1为退出,其他数字为继续):"; cin >> caozuo; if(caozuo == 1) { return 0; } cout << "请输入要查询的考生编号:"; cin >> x; if(x > n) { cout << "不存在此考生!" << endl; continue; } cout << "---------------------" << endl; cout << "该考生名字:" << students[x].name << endl; cout << "该考生学号:" << students[x].number << endl; cout << "该考生的语文成绩:" << students[x].Chinese_score << endl; cout << "该考生的数学成绩:" << students[x].maths_score << endl; cout << "该考生的英语成绩:" << students[x].English_score << endl; cout << "该考生总成绩:" << students[x].total_score << endl; cout << "---------------------" << endl; } return 0; }
-
通过的题目
题目标签
- 二维数组
- 10
- 竞赛
- 7
- 语言基础
- 7
- NOIP
- 6
- 搜索
- 5
- 普及组
- 4
- 其他
- 4
- 高精度
- 4
- 递归
- 3
- 2015
- 2
- 递推
- 2
- 排序
- 2
- 字符串
- 2
- 年份
- 2
- 2001
- 1
- 2002
- 1
- 2004
- 1
- 数据结构
- 1
- 树状数组
- 1
- 逆序对
- 1