4

PHOTO EMBED

Tue Apr 27 2021 02:24:14 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

#include<iostream>
using namespace std;
const int Max = 100;
int buff[Max];
int main()
{
	for (int i = 0; i < Max; i++)
	{
		buff[i] = i;
	}
	ofstream os("edata.txt", ios::binary);
	os.write((char*)buff, Max * sizeof(int));
	os.close();
	for (int i = 0; i < Max; i++)
	{
		buff[i] = 0;
	}
	ifstream is("edata.txt", ios::binary);
	is.read((char*)buff, Max * sizeof(int));
	for (int i = 0; i < Max; i++)
	{
		if (buff[i]!=i)
		{
			cerr << "\ndata is incorrect";
			return 0;
		}
		else
		{
			cout << "\ndata is correct";
		}
	}
}


content_copyCOPY