please help me to make this code it's the second one i post it here
Find matching numbers in text files file1.txt and file2.txt and write them to a new text file result.txt. In each of the source files, the numbers are not repeated. #include<iostream> #include<fstream> #include<iomanip> #include<numeric> #include<math.h> using namespace std; int main(){ int n1,n2; int i=0; int j=0; char tab1[20]{}; char tab2[20]{}; fstream f1; f1.open("c:\\Temp\\file1.txt",ios::in); fstream f2; f2.open("c:\\Temp\\file2.txt",ios::in); fstream f3; f3.open("c:\\Temp\\result.txt",ios::out|ios::trunc); if(f1 && f2 && f3){ while(!f1.eof()&& !f2.eof()){ f1>>n1; f2>>n2; cout << n1 << " "<< n2<< endl; do{ for(i=0;i<n1;i++){ cin>>tab1[i]; for(j=0;j<n2;j++){ if(tab1[i]==tab2[j]) cout<<tab1[i]; f3 << tab1[i] << endl; i++; } } } while(i<n1); } f1.close(); f2.close(); f3.close(); } else{ cout<<"ERROR "<<endl; } system("pause"); return 0; }