#include <string>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int x = 5, y = 5;
vector<vector<int>> A(x, vector<int>(y, 0));
A = {{1,4,7,11,15},{2,5, 8, 12, 19},{3, 6, 9, 16, 22},{10, 13, 14, 17, 24},{18, 21, 23, 26, 30} };
cout << "Size:" << A.size() << endl;
for (int i = 0; i <5; i++) {
for (int j = 0; j <5; j++) {
cout << A[i][j] << " ";
}
cout << endl;
}
system("pause");
return 0;
}
image.png
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> x;
x = { 2, 3, 1, 0, 2, 5, 3 };
for (int i = 0; i < x.size(); i++) {
cout << x[i] << ' ';
}
cout << endl;
system("pause");
return 0;
}
image.png
网友评论