#include<iostream>
#include <fstream>
using namespace std;
int ReadFile(string name="infile.txt"){
fstream inputFile;
int num;
//opening the file
inputFile.open(name);
//reading num
inputFile >> num;
//returning num
return num;
}
int ReadFile(string name1,string name2){
fstream inputFile;
int num;
//opening the file
inputFile.open(name1);
//reading num
inputFile >> num;
ofstream myfile(name2);
//writing to file
myfile<<num;
myfile.close();
return num;
}
int main(){
cout<<ReadFile("infile.txt","outfile.txt");
}
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
Please Like and Support me as it helps me a lot
Get Answers For Free
Most questions answered within 1 hours.