C++11だとstd::vectorの初期化は一行で書ける。
std::vector<int> 変数名(要素数, 何で埋めるのか);
#include <iostream>
#include <vector>
int main(){
int k = 3;
int count = 0;
std::vector<std::vector<int>> vv(k, std::vector<int>(k, 1));
for(auto v: vv){
for(auto t: v){
count += t;
std::cout << count << std::endl;
}
}
return 0;
}
1 2 3 4 5 6 7 8 9