-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3_16.cpp
80 lines (71 loc) · 1.72 KB
/
3_16.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void)
{
vector<int> v1;
vector<int> v2(10);
vector<int> v3(10, 42);
vector<int> v4{10};
vector<int> v5{10, 42};
vector<string> v6{10};
vector<string> v7{10, "hi"};
cout<<"v1的元素个数是: "<<v1.size()<<endl;
if(v1.size() > 0)
{
cout<<"v1的元素分别是: "<<endl;
for(auto mem : v1)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v2的元素个数是: "<<v2.size()<<endl;
if(v2.size() > 0)
{
cout<<"v2的元素分别是: "<<endl;
for(auto mem : v2)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v3的元素个数是: "<<v3.size()<<endl;
if(v3.size() > 0)
{
cout<<"v3的元素分别是: "<<endl;
for(auto mem : v3)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v4的元素个数是: "<<v4.size()<<endl;
if(v4.size() > 0)
{
cout<<"v4的元素分别是: "<<endl;
for(auto mem : v4)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v5的元素个数是: "<<v5.size()<<endl;
if(v5.size() > 0)
{
cout<<"v5的元素分别是: "<<endl;
for(auto mem : v5)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v6的元素个数是: "<<v6.size()<<endl;
if(v6.size() > 0)
{
cout<<"v6的元素分别是: "<<endl;
for(auto mem : v6)
cout<<mem<<" ";
cout<<endl;
}
cout<<"v7的元素个数是: "<<v7.size()<<endl;
if(v7.size() > 0)
{
cout<<"v7的元素分别是: "<<endl;
for(auto mem : v7)
cout<<mem<<" ";
cout<<endl;
}
return 0;
}