#include <stdio.h>
#include <iostream>
#include <ncurses.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
FILE* stream;
int x,y,x1,y1,x2,y2;
printf("Print X and Y\n");
cin >> x >> y;
//x1 = x;
//x2 = x;
// y1 = y;
// y2 = y;
cout <<"X=" << x << "\n" << "Y=" << y << endl;
printf("Press any key to write file\n");
getch();
stream = fopen("File1.txt", "w+");
fprintf(stream, "%d %d", x, y);
fclose(stream);
stream = fopen("File1.txt", "r");
fscanf(stream, "%d %d", &x2, &y2);
printf("X=%d\nY=%d", x2, y2);
printf("\nPress any key to continiued\n");
getch();
fclose(stream);
stream = fopen("File2.bin", "w+b");
fwrite(&x, sizeof(int), 1, stream);
fwrite(&y, sizeof(int), 1, stream);
fseek(stream, 0, SEEK_SET);
fread(&x1, sizeof(int), 1, stream);
fread(&y1, sizeof(int), 1, stream);
fclose(stream);
printf("X=%d\nY=%d", x1, y1);
getch();
}