Advertisement
Guest User

Untitled

a guest
May 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <Rectangle.h>
  4. #include <regex>
  5. using namespace std;
  6. #include <SVG.h>
  7.  
  8. void printMenu()
  9. {
  10. cout<<"1. load from default file"<<endl;
  11. cout<<"2. print objects"<<endl;
  12. cout<<"3.create by command"<<endl;
  13. cout<<"4.translate by command"<<endl;
  14. cout<<"5.erase by index"<<endl;
  15. cout<<"7.exit"<<endl;
  16. }
  17.  
  18. void create(SVG &svg)
  19. {
  20. string command;
  21. std::getline(std::cin, command);
  22. cout<<"COMMAND WAS "<<command<<endl;
  23. svg.createByCommand(command);
  24. }
  25. int main()
  26. {
  27.  
  28. SVG svg = SVG();
  29.  
  30. while(true)
  31. {
  32. printMenu();
  33. cout<<"---Enter option---"<<endl;
  34. string line;
  35. int choice;
  36. cin>> choice;
  37. switch(choice)
  38. {
  39. case 1:
  40. svg.readFromFile("C:\\Users\\Tankz\\Music\\ha.txt");
  41. break;
  42. case 2:
  43. svg.printObjects();
  44.  
  45. break;
  46. case 3:
  47.  
  48. cout<<"Enter command"<<endl;
  49. create(svg);
  50. break;
  51. case 4:
  52.  
  53. cout<<"Enter command"<<endl;
  54. cin>>line;
  55. svg.translate(line);
  56. break;
  57. case 5:
  58. int index;
  59. cout<<"Enter index"<<endl;
  60. cin>>index;
  61. svg.erase(index);
  62. break;
  63. case 6:
  64. case 7:
  65. break;
  66.  
  67. }
  68.  
  69.  
  70. }
  71.  
  72.  
  73.  
  74. /*
  75. SVG svg = SVG();
  76. svg.readFromFile("C:\\Users\\Tankz\\Music\\ha.txt");
  77. svg.createByCommand("create rectangle -1000 -1000 10 20 yellow");
  78. svg.printObjects();
  79.  
  80. svg.erase(4);
  81. svg.translate("translate vertical=10 horizontal=100 1");
  82. svg.printObjects();
  83. svg.erase(1);
  84. svg.printObjects();
  85. svg.erase(4);
  86. svg.translate("translate vertical=10 horizontal=100 ");
  87. svg.printObjects();
  88. */
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement