编程作业:简单的学生管理系统
来源:互联网 发布:snmp数据采集 编辑:程序博客网 时间:2024/05/01 22:25
简单的学生管理系统
题目为:
**Design a program which can implement the following functions:
Get the student information data, which includes name, ID, age and so on, from the standard input stream;
Output these information into the standard output stream according to the specific student’s id.
* vector are recommended as the data type for the container of student information.**
/* * student.cpp * * Created on: 2015-9-25 * Author: */#include <iostream>#include <vector>#include <string>using namespace std;vector<string> stu_name;//定义string类型的vector容器 存放学生姓名vector<int> stu_id;//存放学生IDvector<int> stu_age;//存放学生年龄void Info_input(void);//函数 录入学生信息void Info_output(void);//函数 输出学生信息int main(){ int select=0; do { Info_input(); Info_output(); cout<<"----------Enter 1 to close the project, 2 to continue the project.----------"<<endl; cin>>select; } while(select!=1); cout<<"-------------Hoping to see you again------------"<<endl; return 0;}void Info_input(){ int id=0,age=0; string name; cout<<"----------Enter the number of students----------"<<endl; int count=0; cin>>count; cout<<"-------Enter the students' name,ID and age-------"<<endl; int i=1; for(i=1;i<=count;i++) { cout<<"-----------------Enter the "<<i<<" 'student's Info.-----------------"<<endl; cout<<"Student's Name:"<<endl; cin>>name; cout<<"Student's ID:"<<endl; cin>>id; cout<<"Student's Age:"<<endl; cin>>age; //将姓名、ID、年龄分别压入各个vector的末尾 stu_name.push_back(name); stu_id.push_back(id); stu_age.push_back(age); }}void Info_output(void){ int seek; int key=2; int flag=0; do { cout<<"---------Enter the student's ID you want to looking for:---------"<<endl; cin>>seek; vector<string>::iterator i=stu_name.begin(); vector<int>::iterator j=stu_age.begin(); vector<int>::iterator k=stu_id.begin(); for(;k!=stu_id.end();i++,j++,k++) { //*k取当前下标的vector中的值 if(seek==*k) { cout <<"-------------------The student is found!-----------------"<<endl; cout <<"Name: "<< *i << "\n" <<"Age: "<<*j << "\n" <<"Student ID:"<<*k <<endl; flag=1; break; } else { flag=0; continue; } } if(flag==0) cout<<"---------- Sorry, not founded "<<seek<<" ----------"<<endl; cout<<"----------Enter 1 to continue,2 to break."<<"----------"<<endl; cin>>key; }while(key!=2);}
0 0
- 编程作业:简单的学生管理系统
- C++的大作业,简单学生管理系统
- C# 作业,简单的学生管理系统(控制台)
- 简单的学生管理系统
- 简单的学生管理系统
- 简单的学生管理系统
- 简单的 学生管理系统
- 简单的学生管理系统
- 简单的.NET三层框架的实现(学生作业管理系统)
- C语言实训作业-简单的学生学籍管理系统
- 简单学生管理系统
- 简单学生管理系统
- 简单学生管理系统
- 双链表实现简单的学生管理系统
- 一个简单的学生管理系统
- 简单的java学生管理系统
- Android简单的学生管理系统
- 简单的java学生管理系统
- 多点触摸时ACTION_POINTER_UP和ACTION_UP冲突问题
- Sublime Text 3 快捷键总结(拿走)
- Bootstrap 简介
- 自定义仿优酷界面
- jquery总结
- 编程作业:简单的学生管理系统
- WAP面经 live coding
- OpenCV-Python[第一章]——开发环境搭建(Windows)
- Spring MVC 4.1.3 + MyBatis 零基础搭建Web开发框架
- 【Android 应用开发】GitHub 优秀的 Android 开源项目
- Bootstrap 简介
- 【Spring MVC】 学习笔记
- iOS 开发之内购 – AppStore
- 2016CCPC杭州站打铁纪念