Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- int size;
- int x, n=0;
- srand(time(NULL));
- setlocale(LC_ALL, "rus");
- cout << "Введите размер массивов - ";
- cin >> size;
- cout << "Введите x - ";
- cin >> x;
- int* A = new int[size];
- int* B = new int[size];
- cout << "Массив А :" << endl;
- for (int i = 0; i < size; i++) {
- A[i] = rand() % 50;
- cout << A[i] << ' ';
- if (A[i] < x)n++;
- }
- cout << "Массив B :" << endl;
- for (int i = 0; i < size; i++) {
- B[i] = rand() % 50;
- cout << B[i] << ' ';
- if (B[i] < x)n++;
- }
- cout <<endl<<"Количество элементов меньше х : " <<n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement