#2
myth_feng2010-09-16 11:24
|
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#define N 10
void number(int s[],int &h,int &n)
{
int i;h=0;n=N;
for(i=h;i<h+n;i++)
s[i]=rand()%90+10;
}
void display(int s[],int h,int n)
{
int i;
for(i=h;i<h+n;i++)
cout<<s[i]<<" ";
}
void min(int s[],int h,int n)
{
int j;
int i=h;
for (j=h+1;j<n;j++)
if (s[j]<s[i])
{i=j;}
for(j=i;j<n-1;j++)
{s[j]=s[j+1];}
n--;
cout<<s[j]<<endl;
}
void main()
{
int s[N],h,n;
number(s,h,n);
cout<<"原数组为:"<<endl;
display(s,h,n);
min(s,h,n);
}