c++打印 vectorstring stringArray;
可以使用以下代码打印一个 vector
#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
原文地址: https://www.cveoy.top/t/topic/eQ52 著作权归作者所有。请勿转载和采集!