Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int init_array_c (const int *arr_a, size_t a_size, const int *arr_b, size_t b_size)
- {
- int C[b_size][a_size];
- bool first = true;
- int max;
- for (size_t j = 0; j < b_size; j++)
- {
- for (size_t i = 0; i < a_size; i++)
- {
- C[j][i] = arr_b[j] * arr_a[i];
- if(first == true)
- {
- max = C[j][i];
- first = false;
- }
- if (max < C[j][i])
- max = C[j][i];
- cout << setw(4) << C[j][i];
- }
- cout << endl;
- }
- return max;
- }
- int main (void)
- {
- const size_t a_size = 5, b_size = 10;
- size_t j, i;
- int A[a_size] = {1, 2, 5, 4, 12};
- int B[b_size] = {7, 6, 8, 23, 9, 10, 11, 3, 13, 14};
- cout << "array A: \n";
- for (i = 0; i < a_size; i++)
- cout << setw(4) << A[i];
- cout << "\n\narray B: \n";
- for (i = 0; i < b_size; i++)
- cout << setw(4) << B[i];
- cout << "\n\n";
- cout << "\nmax: " << init_array_c(A, a_size, B, b_size) << endl;
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement