|
|
вернуться в форумWhat is wrong ? (C++) // The code compiles and works fine. (It expects Ctrl+Z to stop user's input). #include <iostream> #include <math.h> #include <vector> #include <stdio.h> using namespace std; int main(){ unsigned long long a; vector<unsigned long long> b; cin.clear(); while (cin >> a, !cin.eof()) { b.push_back(a); }
for (vector<unsigned long long>::reverse_iterator it = b.rbegin(); it != b.rend(); ++it){ printf("%.4f\n", sqrt((long double)*it));
}
return 0; } Re: What is wrong ? (C++) Послано Михаил 29 янв 2015 17:14 x Y u Re: What is wrong ? (C++) Послано Михаил 29 янв 2015 17:14 x Y u Re: What is wrong ? (C++) #include <iostream> #include <math.h> #include <vector> #include <stdio.h> using namespace std; int main(){ unsigned long long a; vector<unsigned long long> b; cin.clear(); while (cin >> a ) { b.push_back(a); if (cin.eof()) break; } for (vector<unsigned long long>::reverse_iterator it = b.rbegin(); it != b.rend(); ++it){ printf("%.4f\n", sqrt((long double)*it)); } return 0; } |
|
|