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
|
#include <iostream>
#include <vector>
#include <iterator>
#include "sales_data.hpp"
#include "sales_item.hpp"
/*
*
*
*
*
*/
int main () {
constexpr int isz = 10;
int fff[isz];
fff[0] = 304234;
std::cout << fff[0] << std::endl;
int arr[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
int (*arr_p)[10] = &arr;
std::cout << &(*arr_p)[2] << " " << &arr[2] << std::endl;
// This syntax is crazy!
int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int *pia = ia;
int *pia2 = &ia[0];
auto apia = ia;
apia[9] = 100;
std::cout << pia << " "
<< pia2 << " "
<< apia << " "
<< apia[9] << " "
<< std::endl;
int ar[] = {0,1,2,3,4,5,6,7,8,9};
int *pbegin = ar;
int *pend = ar + 10;
for( ; pbegin != pend ; ++pbegin) { // Wow look! I've basically made my own iterators!
std::cout << *pbegin << ".";
}
std::cout << std::endl;
for(auto a : ar) {
std::cout << a << ",";
}
std::cout << std::endl;
signed long long int arre[] = {4,547,2365,35,65,2456,244,78,5,33354,0,111,122432,253,32323,-13432,-233333333};
auto p_beg = std::begin(arre);
auto p_end = std::end(arre);
for( ; p_beg != p_end ; ++p_beg) {
*p_beg *= 2;
}
for(auto p : arre) {
std::cout << p << " ";
}
std::cout << std::endl;
int hhh[] = {1,344,224,465333,553,24,12,234,243,2};
int hhhh = *(hhh + 4);
int h4 = *hhh + 10; // 11
std::cout << hhhh << " " << h4 << std::endl;
return 0;
}
|