SHARE
TWEET

Untitled

a guest Sep 21st, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     setlocale(LC_ALL, "Russian");
  7.     cout << "Введите количество элементов массива" << endl;
  8.     int N;
  9.     cin >> N;
  10.     int* a = new int[N];
  11.     int count = 0;
  12.     int x;
  13.     cout << "Введите число" << endl;
  14.     cin >> x;
  15.     for (int i = 0; i < N; i++) {
  16.         cout << "Введите элемент" << endl;
  17.         cin >> a[i];
  18.     }
  19.     for (int i = 0; i < N; i++){
  20.         if (a[i] == x){
  21.             count = 1;
  22.         }
  23.     }
  24.     if (count == 1) {
  25.         cout << "В массиве есть как минимум одно такое число, как " << x << endl;
  26.     }
  27.     else
  28.         cout << "Нет таких чисел";
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top