Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N=5;
- struct uzel
- {
- bool value;
- uzel *right;
- uzel *left;
- };
- class table
- {
- public:
- table(const int N);
- ~table();
- void SetVariable (const int IndexOfVariable,const bool NewValue);
- bool GetVariableValue(const int IndexOfVariable);
- private:
- bool *variables;
- };
- table::table(const int N)
- {
- variables=new bool[N];
- }
- table::~table()
- {
- delete []variables;
- }
- void table::SetVariable(const int IndexOfVariable, const bool NewValue)
- {
- variables[IndexOfVariable]=NewValue;
- }
- bool table::GetVariableValue(const int IndexOfVariable)
- {
- return variables[IndexOfVariable];
- }
- class Node
- {
- public:
- Node();
- ~Node();
- virtual bool Evaluate()=0;
- void smazani(uzel * xRoot);
- private:
- uzel * root;
- };
- Node::Node()
- {
- root=NULL;
- }
- Node::~Node()
- {
- smazani(root);
- }
- void Node::smazani(uzel *xRoot)
- {
- if(xRoot!=NULL)
- {
- smazani(xRoot->left);
- smazani(xRoot->right);
- delete xRoot;
- }
- }
- class insert : public Node
- {
- public:
- insert();
- ~insert();
- void variable(table *variable_table, int IndexOfVariable);
- }
- void insert::variable(table *variable_table, int IndexOfVariable)
- {
- }
- class And : public Node
- {
- };
- class Or : public Node
- {
- };
- class Xor : public Node
- {
- };
- class Not : public Node
- {
- };
- int main()
- {
- table variable_table(N);
- variable_table.SetVariable(0,1);
- variable_table.SetVariable(1, 1);
- variable_table.SetVariable(2, 0);
- Node *root;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment