矢量的矢量 [英] vector of vector
本文介绍了矢量的矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码片段
#include <iostream>
#include <ostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int>>v;
return 0;
}
v.push_back(11)
不工作
什么是正确的?
v.push_back(11)
does not work
what is correct?
推荐答案
#include <iostream>
#include <ostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int> >v;
vector<int> a;
a.push_back(11);
v.push_back(a);
return 0;
}
我认为这应该正确:)
这篇关于矢量的矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文