Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- int main()
- {
- srand(time(0));
- const int arrSizeY{ 5 };
- const int arrSizeXBig{ 10 };
- const int arrSizeXSmall{ arrSizeXBig / 2 };
- int arrBig[arrSizeY][arrSizeXBig]{ {1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10} };
- int arrSmall[arrSizeY][arrSizeXSmall]{ 0 };
- for (int y{ 0 }; y < arrSizeY; ++y)
- {
- for (int x{ 0 }; x < arrSizeXBig; ++x)
- {
- arrBig[y][x] = rand() % 10;
- std::cout << arrBig[y][x] << '\t';
- }
- std::cout << '\n';
- }
- std::cout << '\n';
- for (int y{ 0 }; y < arrSizeY; ++y)
- {
- for (int x{ 0 }; x < arrSizeXSmall; ++x)
- {
- arrSmall[y][x] = (arrBig[y][x * 2] + arrBig[y][x * 2 + 1]);
- std::cout << arrSmall[y][x] << '\t';
- }
- std::cout << '\n';
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment