Main.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <tchar.h>
  2. #include "Point.h"
  3. #include "Circle.h"
  4. #include "List.h"
  5. #include <fstream>
  6. #define stop __asm nop
  7. int main()
  8. {
  9. Point p1(3, 4);
  10. Circle c1 (p1, 4);
  11. Circle c2 (1, 2, 3);
  12. Circle c3(5, 6, 7);
  13. Circle c4(10,10,10);
  14. Circle c5;
  15. Circle c6(1, 2, 3);
  16. Circle c7(1, 2, 3);
  17. List list1;
  18. list1.Ad_to(List::TO::to_tail, c1);
  19. list1.Ad_to(List::TO::to_head, c2 );
  20. list1.Ad_to(List::TO::to_tail, c3);
  21. list1.Ad_to(List::TO::to_tail, c4);
  22. list1.Ad_to(List::TO::to_head, c5);
  23. list1.Ad_to(List::TO::to_tail, c6);
  24. list1.Ad_to(List::TO::to_head, c7);
  25. /*int removed = list1.Remove_all_match(Circle(1,2,3));
  26. std::cout << list1;
  27. std::cout << "Remove: "<<removed<<" nodes.\n\n";*/
  28. stop
  29. List list2;
  30. list2 = list1;
  31. std::cout << list2;
  32. list1.Remove_list();
  33. list1.Ad_to(List::TO::to_tail, Circle(8, 4, 2));
  34. list1.Ad_to(List::TO::to_tail, Circle(7, 11, 18));
  35. list1.Ad_to(List::TO::to_tail, Circle(5, 4, 33));
  36. list1.Ad_to(List::TO::to_tail, Circle(16, 41, 20));
  37. std::cout << list1;
  38. /*List list3;
  39. list3 = std::move(list1);
  40. std::cout << list3;
  41. std::cout << list1;*/
  42. list1.Sort_list();
  43. std::cout << list1;
  44. list2.Sort_list();
  45. std::cout << list2;
  46. int removed = list2.Remove_all_match(Circle(0, 0, 0));
  47. std::ofstream file ("List.txt");
  48. file << list2;
  49. List list3;
  50. std::ifstream fin("List.txt");
  51. if (fin.is_open())
  52. {
  53. fin >> list3; }
  54. else { std::cout << "Error opening file to read " << std::endl; }
  55. fin.close();
  56. std::cout << list3;
  57. stop
  58. return 0;
  59. }