Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using std::cout;
- using std::cin;
- using std::endl;
- #define TAB '\t';
- #define TRIPLENDL cout << endl << endl << endl;
- void main()
- {
- setlocale(LC_ALL, "Ru");
- srand(time(NULL));
- const int n = 10;
- int Numeria[n] = { };
- // int tms;
- int tmp = rand() % 15; // генерация случайного числа
- TRIPLENDL
- for (int i = 0; i < n; ++i)
- {
- // tms = 1;
- for (int j = i + 1; j < n; ++j)
- {
- if (Numeria[i] == Numeria[j])
- {
- // tms += 1;
- }
- }
- for (int j = i - 1; j >= 0; --j)
- if (Numeria[i] == Numeria[j]) tms = 1;
- if (tms > 1) continue;
- else cout << (Numeria[i] = tmp) << TAB;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement