Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- cout << "Введите количество элементов массива" << endl;
- int N;
- cin >> N;
- int* a = new int[N];
- int count = 0;
- int x;
- cout << "Введите число" << endl;
- cin >> x;
- for (int i = 0; i < N; i++) {
- cout << "Введите элемент" << endl;
- cin >> a[i];
- }
- for (int i = 0; i < N; i++){
- if (a[i] == x){
- count = 1;
- }
- }
- if (count == 1) {
- cout << "В массиве есть как минимум одно такое число, как " << x << endl;
- }
- else
- cout << "Нет таких чисел";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement