-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (30 loc) · 948 Bytes
/
Copy pathmain.cpp
File metadata and controls
46 lines (30 loc) · 948 Bytes
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
44
45
46
#include <iostream>
#include <vector>
#include <string>
//wyswietl zawartosc vectora z opisem czego dotyczy
template<typename T> void print_vec(std::vector<T>& vec, const std::string& desc)
{
std::cout<<desc<<": ";
auto vec_size=vec.size();
std::cout<< "size: "<< vec_size <<std::endl;
std::cout<<"vector's data: ";
for(auto i : vec)
std::cout<< i << ", ";
std::cout<<std::endl<<std::endl;
}
int main(int argc, char **argv) {
std::cout<<"argc: "<< argc<<std::endl;
//skopiuj argumenty wywolania programu do vectora
std::vector<std::string> args;
for(int i=0; i<argc; i++){
args.push_back(argv[i]);
}
print_vec(args,"args");
//A tu inny vector
std::vector<int> v={1,2,3,4,5,6};
print_vec(v,"v");
print_vec(args,"vs args");
v.pop_back();
print_vec(v,"v");
return 0;
}