-
Notifications
You must be signed in to change notification settings - Fork 0
/
TypeDef.cpp
43 lines (38 loc) · 873 Bytes
/
TypeDef.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by Jacinto Gomez on 3/7/24.
//
#include <iostream>
#include <vector>
using namespace std;
//Define v2d and v1d so that we don't have to keep writing that long vector declaration step for each function
typedef vector<vector<int>> v2d;
typedef vector<int> v1d;
void print(const v2d& v){
for(const v1d& i:v){
for(int j:i){
cout<<j<<" ";
}
cout<<endl;
}
}
void fillv(v2d input,v2d &output){
for(int i=0;i<input.size();i++){
for(int j=0;j<input[i].size();j++){
output[i][j]=input[i][j];
}
}
}
int main() {
int count=1,dim=3;
v2d input,output;
for(int i=0;i<dim;i++){
v1d temp;
for(int j=0;j<dim;j++){
temp.push_back(count);
count++;
}
output.push_back(temp);
}
fillv(input,output);
print(output);
}