Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- void main()
- {
- int arr[10];
- srand(time(NULL));
- for (int i = 0; i < 10; i++)
- {
- if (i == 0) arr[i] = rand() % 15;
- else
- {
- tip:
- arr[i] = rand() % 10;
- for (int j = i; j > 0; j--)
- {
- if (arr[i] == arr[j-1])
- goto tip;
- }
- }
- }
- for (int i = 0; i < 10; i++)
- {
- cout << arr[i] << ' ';
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement