加文

希望是美好的……
随笔 - 0, 文章 - 209, 评论 - 0, 引用 - 0
数据加载中……

map insert

#include <iostream>
#include <map>
using namespace std;
int main()
{
    typedef map<int,char,less<int>>M;
    M m1;
    m1.insert(M::value_type(2,'B'));
    m1.insert(M::value_type(3,'C'));
    m1.insert(M::value_type(1,'A'));
    M::iterator It = m1.begin();
    cout<<endl<<"m1:"<<endl;
    while(It != m1.end())
    {
        cout<<(*It).first<<" - "<<(*It).second<<endl;
        It++;

    }
    getchar();
    return 0;
}

posted on 2012-04-15 12:32 加文 阅读(172) 评论(0)  编辑 收藏 引用 所属分类: C++


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理