Untitled
#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