您现在的位置: 汕头自考网 >> 串讲笔记 >> 工学类 >> 正文
  • 面向对象上机考试题—关于堆栈(续)
  • 发布日期时间:2007-1-14  来源:网络   点击数:  作者:佚名

 circle cir;
 int s=1;
 while (s)
 {
  cout<<endl;
  cout<<"请选择1-5号键*作"<<endl;
  cout<<" 1: 矩形进栈;"<<endl;
  cout<<" 2: 圆进栈;"<<endl;
  cout<<" 3: 显示栈顶元素;"<<endl;
  cout<<" 4: 出栈;"<<endl;
  cout<<" 5: 退出程序;"<<endl;
  cin>>s;
  switch(s)
  {
  case 1: cin>>rec; Stack.push(rec); break;
  case 2: cin>>cir; Stack.push(cir); break;
  case 3: Stack.top(); break;
  case 4: Stack.pop(); break;
  case 5: s=0; break;
  //default: cout<<"请重新输入"<<endl; break;
  }
 }
}

北京自考

上一页  [1] [2] 

文章转载请注明来源于:汕头自考网