Untitled
#include <iostream> using namespace std; void sum(int m[], int k[], int res[], int size) { for (int i = 0; i < size; i++) { res[i] = m[i] + k[i]; } } int asd(int m[], const int size) { for (int i = 0; i < size; i++) { m[i] = rand() % (size - 5 + 1) + 5; } return 0; } int main() { srand(time(0)); const int n = 20; int mas[n],mas1[n], res[n]; asd(mas, n); asd(mas1, n); sum(mas, mas1, res, n); for (int i = 0; i < 20; i++) { cout << mas[i] << endl; cout << mas1[i] << endl; cout << res[i] << endl << endl; } }
Leave a Comment