Quick actions

cmd+k|ctrl+k

Navigation

Languages

LAB6_186

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-04T17:55:23Z

Updated

2018-12-04T17:56:35Z

#include<iostream>
using namespace std;
 
int main()
{
    int n,a[100],buf;
    
    cin >> n;
    
    for(int i = 0 ; i < n ; i++ ){
        a[i] = 60 -  rand() % 100;
        cout << i+1 << " = " << a[i] << endl ; 
    }
    
    for(int i=n-1;i>=0;i--)
    if(a[i]<0){
        buf=a[i];
        
        for(int j = i ; j > 0 ; j--){
            a[i]=a[i-1];
        }
    a[0]=buf;
    }
    cout << " Конечный массив :" << endl ; 
    for(int i = 0 ; i < n ; i++ ){
        cout<<a[i]<<' ';
    }
 
 
return 0;
}
INFO