mstoyanov7

Untitled

Apr 10th, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <array>
  3.  
  4. const int maxSize = 1000;
  5.  
  6. std::array<int, maxSize> readInput(int& actualSize) {
  7. std::array<int, maxSize> arr{};
  8. std::cin >> actualSize;
  9.  
  10. for (int i = 0; i < actualSize; ++i) {
  11. std::cin >> arr[i];
  12. }
  13. return arr;
  14. }
  15.  
  16. void cartesian(std::array<int, maxSize> arr, int arrSize, int product) {
  17.  
  18. for (int i = 0; i < arrSize; ++i)
  19. {
  20. for (int j = 0; j < arrSize; ++j) {
  21. product = arr[i] * arr[j];
  22. std::cout << product << ' ';
  23. }
  24. product = 0;
  25. }
  26. }
  27.  
  28.  
  29. int main() {
  30.  
  31. int arrSize = 0;
  32. int product = 0;
  33. std::array<int, maxSize> arr = readInput(arrSize);
  34.  
  35. cartesian(arr, arrSize, product);
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment