|
|
back to boardWhy Compile error ;( In DevC++ program compile perfect; And it works; but why isn't working in here :[ Please help me... #include<iostream> using namespace std; int main(){ int k,grup[101]; cin >> k; int majority = k/2+1, min[majority],sum=0; for(int i=0;i<k;i++) cin >> grup[i]; int localMin=grup[0], indx=0,H=0; while(H<majority){ for(int i=1;i<k;i++){ if((grup[i]<localMin)&&(grup[i]>0)){ localMin=grup[i]; indx=i; } } min[H]=localMin/2+1; grup[indx]=-2; H++; } for(int i=0;i<majority;i++) sum += min[i];
cout << sum << endl; } Re: Why Compile error ;( i think there isnt any error...................... Re: Why Compile error ;( error: expression must have a constant value int majority = k/2+1, min[majority],sum=0; ^ int min[250]; int majority = k/2+1,sum=0; Re: Why Compile error ;( Edited by author 03.09.2007 23:00 |
|
|