|
|
back to boardWhat's wrong in my code? Posted by vasya 25 Jul 2007 19:57 #include <iostream> #include <math.h> using namespace std; int main() { long b=-1,c; long A[10000]; while(cin>>c) { b=b+1; A[b-1]=c; } for(int i=b-1;i>=0;i--) { printf(".4ld\n",sqrt(double(A[i]))); } return 0; } Edited by author 25.07.2007 20:00 Re: What's wrong in my code? You must wrote "for(int i=b;i>=0;i--)" or initialize b as "0". Your code dont process last inputted number. P.S. And, by the way, you can write "b++" instead of "b=b+1" ;) This is C++, enjoy it =) |
|
|