http://louisdx.github.io/cxx-prettyprint/

 

#include "prettyprint.hpp"

using namespace std ;

string getsmall(const string &a,const string &b)
{
    return min( make_pair( a.length(),a ) , make_pair( b.length(),b ) ).second ;
}

int main()
{
    string s1{"hello"},s2{"Hello"}  ;
    cout << getsmall(s1,s2) << endl ;

    vector<int> foo;     
    foo.push_back(1);
    foo.push_back(2);
    foo.push_back(3);
    std::cout << "My vector: " << foo << std::endl;

    unordered_map<char*,int> umap ;
    char *p1 = new char(128) ;
    strcpy(p1,"hello world") ;
    char *p2 = new char(128) ;
    strcpy(p2,"hello kitty cat") ;
    umap[p1] = 1  ;
    umap[p2] = 100  ;
    std::cout << "My umap: " << umap << std::endl;

    int arr[10] = { 1, 4, 9, 16 };
    std::cout << arr << std::endl;
} //main

 

My vector: [1, 2, 3]
My umap: [(hello kitty cat, 100), (hello world, 1)]
[1, 4, 9, 16, 0, 0, 0, 0, 0, 0]

 

創作者介紹
創作者 hedgezzz 的頭像
hedgezzz

hedgezzz的部落格

hedgezzz 發表在 痞客邦 留言(0) 人氣()