Advertisement
vadim_sharaf

Untitled

Mar 28th, 2023
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. void txtM::Process(fstream& f, fstream& outFile) {
  2.     if (f.is_open()) {
  3.         f >> resetiosflags(ios::skipws);
  4.         checkCount(f, outFile, countV);
  5.         outFile << endl;
  6.         outFile << "Текст вставка: " << endl;
  7.         int i = 0, k = 0;
  8.         while (i < countV) {
  9.             strL* p1 = new strL(f);
  10.             for (int j = 0; j < p1->len; j++) {
  11.                 outFile << p1->A[j];
  12.             }
  13.             outFile << endl;
  14.             strL* p;
  15.             if (countR != 1 or k != 0) {
  16.                 p = first;
  17.                 while (p->next != last) {
  18.                     p = p->next;
  19.                     if (!p) return;
  20.                 }
  21.             }
  22.             else {
  23.                 p = last;
  24.             }
  25.             if (countR != 1) {
  26.                 p->next = p1;
  27.                 p1->next = last;
  28.             }
  29.             else {
  30.                 if (k == 0) {
  31.                     p1->next = p;
  32.                     first = p1;
  33.                     k += 1;
  34.                 }
  35.                 else {
  36.                     p->next = p1;
  37.                     p1->next = last;
  38.                 }
  39.             }
  40.             i += 1;
  41.         }
  42.         outFile << endl << "Модифицированный текст: " << endl;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement