|
|
back to boardPlease Help(C++) #include <iostream> #include <vector> #include <cmath> using namespace std; int main() { long long val = 0; vector<double> v; while (cin >> val &&val!=EOF) { v.push_back(sqrt(val)); } for (int i = v.size()-1; i >=0; i--) { cout<< v[i] << endl; } return 0; } Re: Please Help(C++) Set your val type to double Re: Please Help(C++) for (int i = v.size()-1; i >=0; i--) { cout << fixed << setprecision(4) << v[i] << endl; } use this. your program is supposed to print 4 points Re: Please Help(C++) Posted by zkv 29 Aug 2021 17:20 try to change "long long val" to "double val" Re: Please Help(C++) Posted by AaBbCc 20 Oct 2021 12:17 for (int i = v.size()-1; i >=0; i--) { cout << ios::fixed << setprecision(4) << v[i] << endl; } |
|
|