zoukankan      html  css  js  c++  java
  • 在C++11编译环境中,简单自测了一下C++标准库中的string/vector和迭代器,记录一下

    #include <iostream>
    #include <vector>
    using namespace std;
    int main()
    {   
        //////////////////// string  测试
        string s = "hello World.";   
        // string s("Hello World.");   //这样写也可以的
        
        cout<< s << std::endl;
       
        //////////////////// vector容器  测试
        vector<int> iVec;
        int i;
        
        for(i = 0; i < 10; i++)
        {
            iVec.push_back(i);
        }
    
        //////////////////// 迭代器  测试
        auto b = s.begin();     //C++11的简易写法
        auto e = s.end() ;
        
        vector<int>::iterator it;   //以前的写法,应该没人喜欢了吧
        
        for( ; b != e; ++b)
        {
            *b = toupper(*b);
        }
        
        cout << s << endl;
        
       
        return 0;
    }
  • 相关阅读:
    0_ReviewML-1
    1_Convolution(卷积)
    0_overview
    遗传算法
    使用多线程下载文件思路
    大文件断点下载
    输出流
    大文件的下载
    XML解析
    文件下载
  • 原文地址:https://www.cnblogs.com/joyer/p/8012170.html
Copyright © 2011-2022 走看看