blob: 9abf5006164bed5f690f570e5c585156d7040918 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include <iostream>
#include <vector>
#include "sales_data.hpp"
#include "sales_item.hpp"
#include <iterator>
/*
*
*
*
*
*/
int main () {
constexpr size_t rowCnt = 3, colCnt = 4;
int ia[rowCnt][colCnt];
for (size_t i = 0; i != rowCnt; ++i) {
for (size_t j = 0; j != colCnt; ++j) {
ia[i][j] = i * colCnt + j;
}
}
for(auto &a : ia) {
for(auto b : a) {
std::cout << b << " ";
}
std::cout << std::endl;
}
int ia2[rowCnt][colCnt];
size_t counter = 0;
for(auto &row : ia2) {
for(auto &col : row) {
col = counter;
++counter;
}
}
std::cout << std::endl;
for(auto &a : ia2) {
for(auto b : a) {
std::cout << b << " ";
}
std::cout << std::endl;
}
std::cout << std::endl;
for(auto a = std::begin(ia2) ; a != std::end(ia2) ; ++a) {
for(auto aa = std::begin(*a) ; aa != std::end(*a) ; ++aa) {
std::cout << *aa << " ";
}
std::cout << std::endl;
}
return 0;
}
|