#include <iostream> #include <ctime> #include <stdlib.h> using namespace std;
int main() { srand(time(0)); int N; cout << "N = ", cin >> N; int A[N]; cout << "A("<<N<<"):"; for(int i = 0; i < N; i++) cout <<" "<< (A[i] = rand() % (N*2+1) -N); int M, B = 0; cout <<"\nM = ", cin >> M; for(int i = 0; i < N; i++) if (A[i] == M) B = 1; cout << (B?"DA":"NET"); return 0; }
#include <ctime>
#include <stdlib.h>
using namespace std;
int main()
{
srand(time(0));
int N;
cout << "N = ", cin >> N;
int A[N];
cout << "A("<<N<<"):";
for(int i = 0; i < N; i++)
cout <<" "<< (A[i] = rand() % (N*2+1) -N);
int M, B = 0;
cout <<"\nM = ", cin >> M;
for(int i = 0; i < N; i++)
if (A[i] == M) B = 1;
cout << (B?"DA":"NET");
return 0;
}