summary5 vector

1、vector<string>

头文件:#include<vector>
              #include<string>

定义:vector<string>  m_vecLiveMode;

输入数据:push_back()

输出数据:cout << m_vecLiveMode[0] <<endl;

举例:

#include <iostream>
#include<vector>
#include<string>
using namespace std;

int main()
{
    vector<string> m_vecLiveMode;
    m_vecLiveMode.push_back("one");
    m_vecLiveMode.push_back("two");

    cout << m_vecLiveMode[0] << endl;
    system("pause");
    return 0;
}

MFC中使用vector<string>还要加上using namesapce std;

猜你喜欢

转载自blog.csdn.net/weixin_40236507/article/details/86735550