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

原因就是你吧long写成了lont, over

Posted by gaminerie at 2006-08-01 11:57:03 on Problem 2388
In Reply To:请问,qsort的一些用法,long int和int怎么不一样 Posted by:hanajiang at 2006-08-01 11:53:47
> 如果用long int,就编译通不过,总是说cmp不对,如果把下面的所有的long int改为int就ac了,不明白为什么,明白的指点一下吧
> #include <iostream.h>
> #include <stdlib.h>
> 
> lont int cmp(const void *a,const void *b)
> {
> 		return *(lont int *)a - *(long int *)b;
> }
> void main()
> {
> 	int N;
> 	cin>>N;
>   long int *a=new  int [N];
> 	for(int i=0;i<N;i++)
> 		cin>>a[i];
> 
> 	qsort(a,N,sizeof(a[0]),cmp);
> 	cout<<a[N/2]<<endl;
> }

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