Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请问我的程序为何会出现“Runtime woring”?????

Posted by plumage at 2005-04-02 12:42:39 on Problem 2388
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator