|  | 
|  | 
| вернуться в форум | I don't know what is wrong with my code, could I use stack here? #include <iostream>#include <stack>
 #include <cmath>
 using namespace std;
 
 int main()
 {
 stack<double> root;
 double input;
 
 while(cin >> input)
 {
 root.push(sqrt(input));
 }
 
 while(!root.empty())
 {
 cout << root.top() << endl;
 root.pop();
 }
 
 return 0;
 }
Re: I don't know what is wrong with my code, could I use stack here? Here your first input while is going infinnity. You have to stop it. | 
 | 
|