コード例 #1
0
ファイル: reverse.cpp プロジェクト: jx63king/CSCI211
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;
}
コード例 #2
0
ファイル: reverse.cpp プロジェクト: Pithers/Class-Work
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;
}