|
|
back to boardwhat is wrong? #include<stdio.h> #include<math.h> int main(void) { double a[256*1024/sizeof(double)];
int i=0;
while(i < 256*1024/sizeof(double)) { scanf("%lf",&a[i]);
i++; } for(--i;i >=0 ; i--) printf("%.4lf\n",sqrt(a[i]));
return 0;
} Re: what is wrong? Posted by melkiy 10 Mar 2009 05:14 The number of input numbers can be less than 256*1024. Use the fact that when scanf cannot read next double it returns 0 (it returns the number of successfully read parameters), and break your while then. Re: what is wrong? just use <stack> from stl |
|
|