| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
请问我的程序为何会出现“Runtime woring”?????#include<iostream.h>
int n;
int array[1000];
int arraysort()
{
int i,j,k;
int temp;
for(i=1;i<n;i++)
{
k=i-1;
for(j=i;j<n;j++)
{
if(array[k]<array[j])
k=j;
}
if(k!=i-1)
{
temp=array[i-1];
array[i-1]=array[k];
array[k]=temp;
}
}
return 1;
}
int main()
{
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>array[i];
arraysort();
cout<<array[n/2]<<endl;
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator