blob: e7d554e643837e46afd8e58c6288450ff52ad852 (
plain)
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
|
#include <iostream>
#include <vector>
/*
*
* 3.31
*
* I mean this was really easy because i just remembered what
* i'd already seen in the last exercise...
* I made one more like the one in the book and one that's
* a little bit more simpler. Not sure how 'correct' the simpler
* version is. Who knows...
*/
int main () {
constexpr size_t ArraySize = 10;
int MyArray[ArraySize];
for(size_t Index = 0 ; Index != ArraySize ; ++Index) {
MyArray[Index] = Index;
}
int MyArray2[10];
for(int Index = 0 ; Index != 10 ; ++Index) {
MyArray2[Index] = Index;
}
for(auto i : MyArray) {
std::cout << i << std::endl;
}
std::cout << std::endl;
for(auto i : MyArray2) {
std::cout << i << std::endl;
}
return 0;
}
|