Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - An integer array of length 10.
An integer array of length 10.
# include & ltiostream.h & gt

Use namespace std

void assign value(int n,int a[]){

int k;

for(; ; ){

k =(int)(rand()* 1000);

for(int j = 0; j & ltn; j++){

if(a[j]= = k)break;

}

if(j = = n)break;

}

a[n]= k;

}

int maxdata(int a[]){

int max = a[0];

for(int I = 1; I<= 10; i++){

if(a[I]& gt; Max)

max = a[I];

}

Return to max

}

int mindata(int a[]){

int min = a[0];

for(int I = 1; I<= 10; i++){

if(a[I]& lt; Minimum)

min = a[I];

}

Returns the minimum value;

}

void main(){

int a[ 10];

for(int I = 0; I< 10; i++){

assign value(I,a);

}

Cout < < "array data is: \ n";

for(int k = 0; k & lt 10; k++)

cout & lt& lta[I]& lt; & lt" ";

cout & lt& lt”\ n”;

The maximum data of cout & lt& lt is: "<< max data (a) < & lt”\ n”;

The minimum data of cout & lt& lt is: "< lt< min data (a) <; & lt”\ n”;

}

The newly written code has not been compiled and executed, and there may be grammatical errors in some places.