Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab6-192

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-11-10T19:50:01Z

Updated

2018-11-10T19:50:01Z

#include <iostream>
using namespace std;

int main() {
    cout << "Введите размер массива" << endl ; 
    int n, i , j;
    cin >> n ; 
    int array[n];
    for (int i=0; i<=(n-1); i++){
        array[i] = rand() % 60 ;
        cout <<i+1<<"-\t" <<  array[i] << endl ; 
    }
    for ( int i = 0; i <=(n-1);i++){
        for (int j=i+1; j<=(n-1);j++){
            if(array[i]==array[j]) {
                array[i] = rand() %60;
            }
        }
    }
    cout <<"Новый массив" << endl ;
    for (int i=0; i<=(n-1); i++){
        cout <<i+1<<"-\t" <<  array[i] << endl ; 
    }
    
    
    return 0;
}
INFO