Program to Find the words starting with a or A from the source code itself and then modify it by removing the words from the source code and put it in another file. The following code doesn't work. Pls Help!!!
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
void Write(fstream &a, char b[])
{ int i;
for(i=0;b[i]!='\0';i++)
{ a.put(b[i]); //Created a duplicate file of the source code
}
}
void main()
{ clrscr();
char *str,ch;
fstream o,i;
o.open("FILE.CPP",ios::in); // adate sddf
o.seekg(0);
cout<<" Altavista App "; //some words starting with A
i.open("DUP.dat",ios::out);
while(!o.eof())
{ o.get(ch);
i.put(ch);
}; // asprine ddjgdssd sdag sas aadfd
i.seekg(0);
o.close();
fstream j("adate.dat",ios::out);
o.open("TEMP.DAT",ios::out);
while(!o.eof())
{ o.get(str,40,' ');
if(str[0]=='a'||str[0]=='A')
{ Write(j,str);
}
else Write(o,str);
strcpy(str, "\0");
};
cout<<"\n\n\t\t\tOperation Completed!";
getch();
};
Reply fast pls.