Guest User

Untitled

a guest
Apr 20th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include "Tree.h"
  2. int main (void)
  3. {
  4. Tree_node Top;
  5. string Simbol;//символ
  6. ifstream file("Base.txt");
  7. getline (file, Simbol);
  8. Top = *Construction_tree(Simbol, file);
  9. User New_user(Top);
  10. New_user.Parse("sooqa");
  11. file.close();
  12. Cleaner(&Top);
  13. return 0;
  14.  
  15. }
  16. void Cleaner (Tree_node * Top_node)
  17. {
  18. for (int n = 0; n < Top_node -> Down.size(); ++n)
  19. {
  20. Cleaner (Top_node -> Down[n]);
  21. }
  22. delete Top_node;
  23. }
  24. Tree_node * Construction_tree(string Node, ifstream &file)
  25. {
  26. cout<<"soqa ";
  27. string Simbol_;
  28. Tree_node *Top_node = new Tree_node;
  29. Top_node->Name_of_node = Node;
  30. Top_node->IsAHum_ = 0;
  31. getline (file, Simbol_);
  32. if (Simbol_ == "{")
  33. {
  34. getline (file, Simbol_);
  35. while (Simbol_ != "}" && file)
  36. {
  37. Top_node->Down[Top_node -> Down.size()] = &Construction_tree(Simbol_, file);
  38. getline (file, Simbol_);
  39. }
  40. }
  41. else if (Simbol_ == "[")
  42. {
  43. getline (file, Simbol_);
  44. string Name_of_work;
  45. Name_of_work = Simbol_.substr(0,Simbol_.find("~"));
  46. Simbol_ = Simbol_.substr(Simbol_.find("~")+1);
  47. Top_node->Work[Name_of_work] = Simbol_;
  48. Top_node->IsAHum_ = 1;
  49. }
  50. return Top_node;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment