int main() { double value; Dstack stack; // as long as there is input while (cin >> value) stack.push(value); // as long as the stack is not empty, pop numbers and print them while (!stack.empty()) cout << stack.pop() << endl; return 0; }
int main() { double temp = 0; Dstack stack; while(cin >> temp) { stack.push(temp); } cout << "There are " << stack.size() << " numbers in the stack.\n"; while(!stack.empty()) { stack.pop(temp); cout << temp << endl; } cout << "There are " << stack.size() << " numbers in the stack.\n"; return 0; }