Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
359 B
1
Indexable
Never
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

const string b = "Asd.txt";
void vod(int &a)
{
	ofstream c(b);
	c << a;
	c.close();
}
void foo(int &a)
{
	ifstream c(b);
	if (!c.is_open())
	{
		cout << "error";
	}
	vod(a);
	c >> a;
	c.close();
}
int main()
{
	int a;
	cin >> a;
	foo(a);
	cout << a;
}
Leave a Comment