|
|
вернуться в форумTried so many times, still failed. Hope help. Послано J.Liu 27 авг 2013 09:15 #include <iostream> #include <math.h> using namespace std; int main() { double *n = new double[10000000]; double buf; int index = 0; while(1) { cin >> buf; if(cin.eof()) { break; } else { n[index++] = sqrt(buf); } } index--; cout.precision(4); while(index >= 0) cout << fixed << n[index--] << endl; delete [] n; } Re: Tried so many times, still failed. Hope help. Послано J.Liu 27 авг 2013 09:26 // This one pass. #include <iostream> #include <math.h> using namespace std; int main() { double *values = new double[131072]; double buf; int index = 0; while(cin >> buf) { values[index++] = sqrt(buf); } index--; while (index >= 0) printf("%.4f\n", values[index--]); delete [] values; } Edited by author 27.08.2013 09:26 Edited by author 27.08.2013 09:26 |
|
|