题目1069:查找学生信息
来源:互联网 发布:cmd网络测试命令 编辑:程序博客网 时间:2024/05/25 19:56
#include <iostream>#include <fstream>#include <string>using namespace std;const int N = 1010;struct Student{string id;string name;string sex;int age;};Student student[N];int main(){int n, m;#ifndef ONLINE_JUDGEifstream cin("d:\\OJ\\uva_in.txt");#endifwhile (cin >> n) {//cout << "n:" << n << endl;for (int i = 0; i < n; i++) {cin >> student[i].id >> student[i].name >> student[i].sex >> student[i].age;//cout << "name:" << student[i].name << " sex:" << student[i].sex << endl;}cin >> m;string id;for (int i = 0; i < m; i++) {cin >> id;bool found = false;for (int j = 0; j < n; j++) {if (student[j].id == id) {cout << student[j].id << " " << student[j].name << " " << student[j].sex << " " << student[j].age << endl;found = true;break;}}if (!found) cout << "No Answer!" << endl;}}return 0;}
0 0
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息
- 题目1069:查找学生信息 题目18
- 九度题目1069:查找学生信息
- 18-题目1069:查找学生信息
- 【九度】题目1069:查找学生信息
- 题目18:查找学生信息
- 题目1069:查找学生信息(二分查找)
- <九度 OJ>题目1069:查找学生信息
- C++ 中string.find() 函数的用法总结
- 接口 需求: 电脑运行实例, 电脑运行基于主板。
- 044] 微信公众平台开发教程第20篇-新手解惑40则
- catalina.sh java 内存调整
- NSUserDefault
- 题目1069:查找学生信息
- 输出文件夹中的短文件名到文本中(批处理)
- 第二次软工实验
- 资源的导入和导出
- Effective Java (2) - 遇到多个构造器参数时要考虑用构建器
- java中使用LinkedList类的实例
- MySQL学习笔记 2
- 阿里云CentOS环境搭建(Tomcat、JDK、MySql)
- 用栈实现队列,用队列实现栈 Queue Using Stacks and Stack Using Queues