Skip to content

Commit d34d96f

Browse files
committed
chpt 6
1 parent 1eefdac commit d34d96f

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

  • source/chpt_6_ListAndIteratorADTs
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <algorithm>
2+
#include <iostream>
3+
#include <ostream>
4+
#include <vector>
5+
6+
int main(int argc, char const *argv[]) {
7+
std::vector<int> a(8);
8+
std::cout << &a << std::endl;
9+
10+
int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
11+
12+
std::vector<int> vector(array, array + 10);
13+
14+
for (int i = 0; i < vector.size(); i++) {
15+
std::cout << vector.at(i) << " ";
16+
} std::cout << std::endl;
17+
18+
std::random_shuffle(vector.begin(), vector.end());
19+
20+
for (int i : vector) {
21+
std::cout << vector.at(i) << " ";
22+
} std::cout << std::endl;
23+
24+
return 0;
25+
}

0 commit comments

Comments
 (0)