第15周阅读程序(6)

news/2024/7/7 15:55:32
/*
*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;
}

运行结果:



http://www.niftyadmin.cn/n/3628383.html

相关文章

poj 3208 Apocalypse Someday 数位dp+二分答案

Apocalypse Someday Time Limit: 1000MS Memory Limit: 131072KTotal Submissions: 2203 Accepted: 1110Description The number 666 is considered to be the occult “number of the beast” and is a well used number in all major apocalypse themed blockbuster movies. …

emacs使用笔记

C-h t tutorial [移动基本操作]C-f C-b C-p C-n 前后上下 C-v C-a 行首 C-e行尾C-a 和 C-e 可以将光标移动到"一行"的头部和尾部。M-a 和 M-e 则将光标移动到“一句”的头部和尾部。M-f 向后移动一个单词 M-b 向前移动一个单词C-k 删除 C-v 下一页 M-v 上一页M-< …

red hat Linux配置ip

初次接触Linux &#xff0c;最开始的需要就是上网。配置IP成了学习使用Linux的第一个功课。 1.设置IP地址 查看你使用的IP网卡 ifconfig -a 找到你要使用的网卡 vi/etc/sysconfig/network-scripts/ifcfg-eth0 #IntelCorporation82801BA/BAM/CA/CAMEthernetController DEVICEet…

nyist 14 会场安排问题

以结束时间排序&#xff0c;一开始用了先按照开始时间排序&#xff0c;开始时间相同的按结束时间排&#xff0c;很荣幸的WA了&#xff0c;沉思了一会&#xff0c;用了以结束时间来排序&#xff0c;提交 AC了&#xff0c; 纠结了一会儿&#xff0c;这个。。。。。。。。。。 若以…

2018年9月16号 开学训练日志

昨天没有网络赛就忘了写训练日志。 刚把一道题看明白&#xff0c;昨天下午看了一下午&#xff0c;今天又看了一早上&#xff0c;现在我要按我自己的对数位DP的理解去调试代码&#xff0c;又要开始疯狂的写bug了。

WinForm 之 自定义标题栏的窗体移动

通过标题栏的鼠标事件实现窗体移动&#xff0c;代码如下&#xff1a; bool m_isMouseDown false; //窗体是否移动Point m_mousePos; //记录窗体的位置/// <summary>/// 鼠标按下&#xff0c;开启移动/// </summary>/// <param name"sender"></…

第15周实践项目1——程序填空

/* *Copyright (c) 2016,烟台大学计算机学院 *All rights reserved. *文件名称 : *作 者 : 刘云 *完成日期 : 2016年6月7号 *版 本 号 : v6.0 * *问题描述 : 请填空将程序补充完整。 *输入描述 :无 *程序输出 : */#include <iostream> #include <vector> #include …

面试题 链表中的若干问题

一次遍历找链表倒数第n个节点通过一次遍历找到单链表中倒数第n个节点&#xff0c;链表可能相当大&#xff0c;可使用辅助空间&#xff0c;但是辅助空间的数目必须固定&#xff0c;不能和n有关。不管是顺数n个还是倒数n个&#xff0c;其实都是距离-标尺问题。标尺是一段距离可以…