第15周阅读程序(6)
2016-06-07 19:22
232 查看
/* *Copyright (c) 2016,烟台大学计算机学院 *All rights reserved. *文件名称 : *作 者 : 刘云 *完成日期 : 2016年6月7号 *版 本 号 : v6.0 * *问题描述 : 阅读程序 *输入描述 :无 *程序输出 : */ #include<string> #include<iostream> #include<map> using namespace std; class CStudent { public: int nStudentID; int nAge; public: CStudent(){ } CStudent(int nSID,int nA) { nStudentID=nSID; nAge=nA; } //复制构造函数 CStudent(const CStudent& ob) { nStudentID=ob.nStudentID; nAge=ob.nAge; } }; int main() { map<string,CStudent>mapStudent; mapStudent["zhangsan"]=CStudent(100012,22); mapStudent["Lisi"]=CStudent(100085,21); mapStudent["Wangwu"]=CStudent(100093,23); cout<<"The Student number for Lisi is "<<(mapStudent["Lisi"].nStudentID)<<endl; return 0; }
运行结果:
相关文章推荐
- Spring Boot 实践折腾记(一):快速,Hello World例子
- 八数码问题 bfs
- fedora samba|qemu iptables 设置
- Android 基于Message的进程间通信 Messenger完全解析
- 视频框架 Vitamio 使用教程+部分心得 (二)第一个视频demo
- Spring JDBC 的使用
- LeetCode 274: H-Index
- 常用正则表达式总结
- JAVA分数运算
- HTTP消息中header头部信息的讲解
- 第15周阅读程序(5)
- Android 热补丁动态修复框架小结
- 创建数据库,数据库内部增删改查语句
- linux下统计程序编译时间
- 队列的数组实现与链表实现
- 一切皆是对象
- android 蓝牙模块学习
- 飛飛(六十)交通工具 虚函数的应用
- 关于tomcat作为服务器 URL访问的一些问题
- android ImageLoader 混淆加载drawable出现黑色图片的解决方案