Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- srand(time(NULL));
- int arr[10]{};
- bool isThere;
- for (int i = 0; i < sizeof(arr) / sizeof(arr[0]);) {
- isThere = false;
- int randint = rand() % 10;
- for (int j = 0; j < i; j++) {
- if (arr[j] == randint) {
- isThere = true;
- }
- }
- if ((!isThere) && (randint!=0)) {
- arr[i] = randint;
- i++;
- }
- }
- for (int x = 0; x < 10; x++) {
- cout << arr[x] << endl;
- }
- int min = arr[0];
- for (int x = 1; x < sizeof(arr) / sizeof(arr[0]); ++x) {
- if (arr[x] < min) {
- min = arr[x];
- }
- }
- cout << endl << min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement