|
|
вернуться в форумCompile error Послано rGV 27 ноя 2007 01:40 what's wrong with my source? I can run it on my pc but there is "Compilation error" #include <iostream> using namespace std; int quicksorta(int b[],int c[],int N) { int h = 0, f = N; int temp, p; p=b[N>>1]; do { while (b[h]<p) h++; while (b[f]>p) f--; if (h<=f) { temp=0; temp=b[h]; b[h]=b[f]; b[f]=temp; temp=c[h]; c[h]=c[f]; c[f]=temp; h++; f--; } } while (h<=f); if (f>0) quicksorta(b,c,f); if (N>f) quicksorta(b+h,c,N-h); return 0; } int main() { int i; int n; cin>>n; int c[n],b[n]; for (i=0;i<n;i++) cin>>c[i]>>b[i]; quicksorta(b,c,n); for (i=n-1;i>0;i--) cout<<c[i]<<" "<<b[i]<<endl; cout<<c[0]<<" "<<b[0]; return 0; } Re: Compile error 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2057: expected constant expression 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2466: cannot allocate an array of constant size 0 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2133: 'c' : unknown size 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2057: expected constant expression 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2466: cannot allocate an array of constant size 0 1>c:\lxn\visual studio 2005\projects\1100\1100\1100.cpp(102) : error C2133: 'b' : unknown size |
|
|