可以使用以下代码打印一个 vector 类型的 stringArray:

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    vector<string> stringArray = {"hello", "world", "c++", "vector", "string"};

    for (string s : stringArray) {
        cout << s << " ";
    }

    return 0;
}

输出结果:

hello world c++ vector string
c++打印 vectorstring stringArray;

原文地址: https://www.cveoy.top/t/topic/eQ52 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录