Advertisement
Mikhail-Podbolotov

Untitled

May 8th, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include "library.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     ifstream input("input.txt");
  7.     ofstream output("output.txt");
  8.     List A;
  9.     A.Read(input);
  10.     A.Print(output);
  11.     List B;
  12.     Point* curPoint = A.getStart();
  13.     int n = A.GetLast();
  14.     while (curPoint != nullptr) {
  15.         B.addPoint();
  16.         AdjPoint* curAdjPoint = curPoint->First;
  17.         for (int i = 1; i <= n; i++) {
  18.             if (curAdjPoint == nullptr) {
  19.                 if (i != curPoint->number)
  20.                     B.addAdjPoint(i);
  21.             }
  22.             else if (curAdjPoint->value != i) {
  23.                 if (i != curPoint->number)
  24.                     B.addAdjPoint(i);
  25.             }
  26.             else curAdjPoint = curAdjPoint->next;
  27.         }
  28.         curPoint = curPoint->NextPoint;
  29.     }
  30.     output << "result: " << endl;
  31.     B.Print(output);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement