Untitled
unknown
c_cpp
2 years ago
643 B
8
Indexable
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
void fill(int m[], const int size, int a, int b) {
for (int i = 0; i < size; i++) {
m[i] = rand() % (b - a + 1) + a;
}
}
void fill2(int m1[], int m2[], int m3[], const int size,int a,int b) {
fill(m1, size, a, b);
fill(m2, size, a, b);
for (int i = 0; i < size; i++) {
m3[i] = m1[i] + m2[i];
}
}
int main()
{
srand(time(0));
int a, b;
cin >> a >> b;
const int size = 1000;
int m1[size];
int m2[size];
int m3[size];
fill2(m1, m2, m3, size, a, b);
for (int i = 0; i < size; i++) {
cout << m3[i] << " ";
}
}Editor is loading...
Leave a Comment