how can i make this programm with class????
#include <fstream>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
char temp_char [200];
string file1,file2;
int i=0;
ifstream indata;
indata.open("config.txt");
if(!indata)
{
cerr << "Error: file could not be opened" << endl;
exit(1);
}
int first_row=true;
while (!indata.eof())
{
while (indata.getline(temp_char,200,'\n'))
{
if (first_row)
{
file1=temp_char;
first_row=false;
//cout<<file1<<endl;
}
else
file2=temp_char;
//cout<<file2<<endl;
}
}
indata.close();
char * buffer;
int long size;
buffer = new char [size];//allocate memory for file content
ifstream examplefile (file1.data());
ofstream fout (file2.data());
if (! examplefile.is_open())
{ cout << "this thing doesn't work "; exit (1); }
while (! examplefile.eof() )
{
examplefile.getline (buffer,size);//get line tou *.txt file
i+=1;
fout << buffer << endl;
}
examplefile.close();
fout <<"\n\nthe lines of this *.txt are: \t"<<i<<endl;
fout.close();
cout <<"\nthe procedure has been done"<<endl;
return 0;
}