Advertisement
VladimirKostovsky

Лаб 1.4 (б). Редакция 0.3

Feb 24th, 2022
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cmath>
  3.  
  4. int main() {
  5.     struct polinom { char l; polinom* next; };
  6.     polinom* head, * p; polinom* head2, *p2; char ch;
  7.     fopen_s(&f, "input.txt", 'r');
  8.     head = p = new polinom;
  9.     fopen_s(f, &f, "input.txt", 'r');
  10.     fscanf_s(f, "%c", &ch);
  11.     int i;
  12.     while (ch != '\n') {
  13.         p->next = new polinom;
  14.         p = p->next;
  15.         p->l = ch;
  16.         scanf_s(f, "%c", &ch);
  17.     }
  18.     p2 = p;
  19.     p->next = NULL;
  20.  
  21.     head2 = p2 = new polinom;
  22.     scanf_s("%c", &(p2->l));
  23.     scanf_s("%c", &ch);
  24.     while (ch != '\n') {
  25.         p2->next = new polinom;
  26.         p2 = p2->next;
  27.         p2->l = ch;
  28.         scanf_s(f, "%c", &ch);
  29.     }
  30.     p2->next = NULL;
  31.  
  32.     fclose(f);
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement