ostapdontstop

fprintf

Feb 2nd, 2018
170
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. // #include <stdlib.h>
  3. int main() {
  4.     FILE *S1, *S2;
  5.     int x = 3, y;
  6.     // system("chcp 1251");
  7.     // system("cls");
  8.     // printf("Введите число: ");
  9.     // scanf("%d", &x);
  10.     S1 = fopen("S1.txt", "w");
  11.     fprintf(S1, "%d", x);
  12.     fclose(S1);
  13.     S1 = fopen("S1.txt", "r");
  14.     S2 = fopen("S2.txt", "w");
  15.     fscanf(S1, "%d", &y);
  16.     y *= 3;
  17.     fclose(S1);
  18.     fprintf(S2, "%d\n", y);
  19.     fclose(S2);
  20.     return 0;
  21. }
RAW Paste Data