第十五周程序-阅读程序-6
来源:互联网 发布:淘宝商城行车记录仪 编辑:程序博客网 时间:2024/06/07 05:10
/*copyright(c)2016.烟台大学计算机学院 * All rights reserved, * 文件名称:text.Cpp * 作者:刘涛 * 完成日期:2016年6月5日 * 版本号:vc++6.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;}
运行结果:
<img src="http://img.blog.csdn.net/20160605112637820?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
0 0
- 第十五周--阅读程序6
- 第十五周程序-阅读程序-6
- 第十五周阅读程序
- 第十五周阅读程序
- 第十五周--阅读程序
- 第十五周程序-阅读程序
- 第十五周阅读程序(6)
- 第十五周阅读程序(6)
- 第十五周项目—阅读程序(6)
- 第十五周项目 阅读程序(6)
- 第十五周阅读程序(6)
- 第十五周项目—阅读程序(6)
- 第十五周阅读程序——6
- 第十五周(6)-阅读程序
- 第十五周 程序阅读二
- 第十五周阅读程序1
- 第十五周阅读程序2
- 第十五周阅读程序3
- 流(3.5.1~3.5.2)
- 文章标题
- Live Stream Procedure
- Centos下vim、ctags的配置及基本用法
- Spring 3整合Quartz 2实现定时任务--转
- 第十五周程序-阅读程序-6
- javaagent
- microstation level2 1001 hatch
- ExecutorService的execute和submit方法
- 关于项目组成部门的接口人
- Git、GitTortoise、Github版本控制流程
- c++实验7-特殊三位数
- 用laravel写的项目如何布置在虚拟机上
- Android键盘