欧美色欧美亚洲高清在线观看,国产特黄特色a级在线视频,国产一区视频一区欧美,亚洲成a 人在线观看中文

  1. <ul id="fwlom"></ul>

    <object id="fwlom"></object>

    <span id="fwlom"></span><dfn id="fwlom"></dfn>

      <object id="fwlom"></object>

      c++24點(diǎn)游戲

      時(shí)間:2019-05-13 03:02:12下載本文作者:會(huì)員上傳
      簡(jiǎn)介:寫寫幫文庫(kù)小編為你整理了多篇相關(guān)的《c++24點(diǎn)游戲》,但愿對(duì)你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫(kù)還可以找到更多《c++24點(diǎn)游戲》。

      第一篇:c++24點(diǎn)游戲

      c++24點(diǎn)游戲

      #include “iostream” #include “string” using namespace std;

      //定義Stack類

      const maxsize=20;

      enum Error_code { success, overflow, underflow };

      template class Stack { public: Stack();

      bool empty()const;bool full()const;int size()const;void clear();

      Error_code top(T &item)const;Error_code pop();

      Error_code push(const T &item);private: int count;T entry[maxsize];};

      template Stack::Stack(){ count=0;}

      template

      bool Stack::empty()const { return count==0;}

      template

      bool Stack::full()const { return count==maxsize;}

      template int Stack::size()const { return count;}

      template void Stack::clear(){ count=0;}

      template

      Error_code Stack::top(T &item)const { if(empty())return underflow;item= entry[count-1];return success;}

      template

      Error_code Stack::pop(){ if(empty())return underflow;count--;return success;}

      template

      Error_code Stack::push(const T &item){ if(full())return overflow;entry[count++]=item;return success;}

      Stack sign;Stack num;

      int set;

      // 判斷程序中的異常,以便適時(shí)退出?//

      void process(char c)

      //計(jì)算兩個(gè)數(shù)的 +-* / 運(yùn)算// { int k=0;double a,b;sign.pop();

      if(num.top(b)==success){

      num.pop();

      if(num.top(a)==success){ num.pop();k=1;} } if(k){ switch(c){

      case '+': num.push(a+b);break;case '-': num.push(a-b);break;case '*': num.push(a*b);break;case '/': if(b==0){ set=4;num.push(-1);} else

      num.push(a/b);break;} }

      else {set=1;num.push(-1);} }

      void get_command(string &str){

      cout<<“n請(qǐng)輸入要進(jìn)行運(yùn)算的表達(dá)式,包括” +,-,*,/,=,(,)“和數(shù)字,”<

      <<“注意: 以數(shù)字開頭,等號(hào)結(jié)尾,中間括號(hào)要匹配.”<>str;}

      double do_command(const string &str){ string s=“";

      double outcome=-1;char c;

      for(int i=0;str[i]!='