⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node.cpp

📁 一个二十四点的游戏
💻 CPP
字号:
#include "Fraction.cpp"


class node    //节点node:s=0时存放分数,s=1时存放运算符 
{
    public:
            bool s;       
            Fraction Fr;
            char sign;
            
            node():s(0),Fr(0,1){};
            node(const int&);
            node(const char&);
            node &operator=(const int&);
            node &operator=(const char&);
            node &operator=(const node&);
};



node::node(const int &x):Fr(x),s(0){}



node::node(const char &x):sign(x),s(1){}

  

node &node::operator=(const int &x)
{      
       s=0;
       Fr.fm=1;  
       Fr.fz=x;
       return (*this);
}       
    
 
                                      
                                                                               
node &node::operator=(const char &x)
{
       s=1;
       sign=x; 
       return *this;
}                                        
       
                                                                              

node &node::operator=(const node &x)
{
   if(x.s)sign=x.sign;
   else Fr=x.Fr;
   s=x.s;
   return *this;
}   
   
                                                                                                                                                                                                                               

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -