Advertisement
VladimirKostovsky

Работа с файлами (код с пары)

Feb 24th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. int main() {
  6.     struct bukva { char l; bukva* next; };
  7.     bukva* head, * p; char ch; FILE *f;
  8.     fopen_s(&f, "input.txt", 'r');
  9.     head = p = new bukva;
  10.     fopen_s(f, &f, "input.txt", 'r');
  11.     fscanf_s(f, "%c", &ch);
  12.     while (ch != "/n") {
  13.         p->next = new bukva; p = p->next; p->l = ch;
  14.         scanf(f, "%c", &ch);
  15.     }
  16.     p->next = NULL;
  17.     fclose(f);
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement