|
|
back to boardI don't know what is wrong with my code, could I use stack here? Posted by JK Love 23 Jan 2022 03:46 #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. |
|
|