Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <array>
- const int maxSize = 1000;
- std::array<int, maxSize> readInput(int& actualSize) {
- std::array<int, maxSize> arr{};
- std::cin >> actualSize;
- for (int i = 0; i < actualSize; ++i) {
- std::cin >> arr[i];
- }
- return arr;
- }
- void cartesian(std::array<int, maxSize> arr, int arrSize, int product) {
- for (int i = 0; i < arrSize; ++i)
- {
- for (int j = 0; j < arrSize; ++j) {
- product = arr[i] * arr[j];
- std::cout << product << ' ';
- }
- product = 0;
- }
- }
- int main() {
- int arrSize = 0;
- int product = 0;
- std::array<int, maxSize> arr = readInput(arrSize);
- cartesian(arr, arrSize, product);
- }
Advertisement
Add Comment
Please, Sign In to add comment