QUOTE(KYA @ 1 Dec, 2008 - 01:42 PM)

darkrut, post in the C++ forums, you'll get a better response there.
like you asked for ,KYA , here my code!!thank you for helping
CODE
#include<iostream>
#include<fstream>
#include<string>
#include <vector>
using namespace std;
struct node
{
string kelima;
int compteur;
node *link;
};
class Pile
{
private:
node* top;
public:
Pile()
{
top=NULL;
}
void EMPILER(int n,string terme)
{
node *tmp;
tmp=new node;
cout<<terme<<endl;
tmp->kelima=terme;
tmp->compteur=n;
tmp->link=top;
top=tmp;
}
void VerifInc(string terme)
{ int trouve=0,z;
node *tmp;
tmp=top;
while(tmp!=NULL)
{
if (terme.compare(tmp->kelima)==0)
{tmp->compteur++;
z=tmp->compteur;trouve=1;break;}
tmp=tmp->link;
}
if(trouve==0)
{
EMPILER(1,terme);
}
}
int CompTerme(string terme)
{ int trouve=0,v;
node *tmp;
tmp=top;
while(tmp!=NULL)
{
if (terme.compare(tmp->kelima)==0)
{v=tmp->compteur;return v;}
tmp=tmp->link;
}
///////////////////////////////////////////////////////////////Here is my probleme/////////
return 0;
}
void RESTerme(int n)
{ node*temp;
node*teo;
while(top->compteur<n)
{
temp=top->link;delete top;top=temp;if(top==NULL)break;
}temp=top;
while(temp!=NULL)
{ if(temp->compteur<n)
{teo=temp->link;
temp->link=teo->link;}
else temp=temp->link;
}
}
};
/////////////////////////////////////////////////////////////////////////////////////////////
string RLTrim(string term)
{ string sof=" ";
if (term!=" "){
int x=term.length();
if
(term.compare(0,1,sof)==0)
{term=term.erase(0,1);
if(term.compare(term.size(),1,sof))
term.erase(term.size(),1);
}
}
return term;
}
string decomposer(string term)
{int foundv,foundpv,founddp;
foundv=term.find(",");
foundpv=term.find(";");
founddp=term.find(":");
while(foundv!=string::npos)
{ term.replace(foundv,1," ");
foundv=term.find(",");
}
while(foundpv!=string::npos)
{
term.replace(foundpv,1," ");
foundpv=term.find(";");
}
while(founddp!=string::npos)
{
term.replace(founddp,1," ");
founddp=term.find(":");
}
return term;
}
void enregistrerPh (string phrase)
{ ofstream myfile;
myfile.open("phrase.txt",ios::app);
if (myfile.is_open())
{
myfile << phrase + "\n";
}
myfile.close();
}
void enregistrerTerm (string jomla)
{ ofstream myfile;
myfile.open("terme.txt",ios::app);
if (myfile.is_open())
{
myfile << jomla + "\n";
}
myfile.close();
}
void FreeStopList(string phrase,string terms[])
{
int i=0,xposition=0,trouve=0,foundE;
string MajTerm;
string term;
phrase=RLTrim(phrase);
phrase=decomposer(phrase);
foundE=phrase.find(" ");
while (phrase!=""){
term=RLTrim(phrase);
term=phrase.substr(0,foundE);
phrase=phrase.erase(0,foundE);
phrase=RLTrim(phrase);
foundE=phrase.find(" ");
for(i=0;i<750;i++)
{ if (term.compare(terms[i])==0)
{trouve=1;}
} if (trouve==0)
enregistrerTerm(term);
trouve=0;
if (phrase.compare(term)==0)
break;
}
}
string TraitementPh(string line)
{int foundPI,foundPE;
foundPE=line.find("!");
foundPI=line.find("?");
while(foundPE!=string::npos)
{ line.replace(foundPE,1,".");
foundPI=line.find(",");
}
while(foundPI!=string::npos)
{ line.replace(foundPI,1,".");
foundPI=line.find(",");
}
return line;
}
string decomposerln(string line,string stoplist[])
{
int foundPoint;
string ph;
foundPoint=line.find(".");
while(foundPoint!=string::npos)
{ ph=line.substr(0,foundPoint);
ph=RLTrim(ph);
enregistrerPh(ph);
FreeStopList(ph,stoplist);
cout << ph+"\n";
line.erase(0,foundPoint+1);
foundPoint=line.find(".");
}
return line;}
void main()
{
string term;
int i=0,z=0;
string v,kelima,mot,fichier="test.txt";
string stoplist[2000];
string line;
ifstream myfile("StopList.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{getline(myfile,line);
z++;
stoplist[i]=line.erase(line.length());
mot=stoplist[i];
if (mot.length()>3)
{kelima=RLTrim(mot);
stoplist[i]=kelima;}
i++;
}myfile.close();
}
else cout << "unable tu open StopList";
string jomla=" ";
ifstream monfile("document.txt");
if (monfile.is_open())
{
while (!monfile.eof())
{getline(monfile,line);
if (line.compare("")!=0)
{ jomla+=" "+line;
jomla=TraitementPh(jomla);
jomla=decomposerln(jomla,stoplist);
}
}
}else cout << "unable tu open Document";
Pile s;
string lines;int sof;
ifstream myfiles ("terme.txt");
if (myfiles.is_open())
{
while (! myfiles.eof() )
{getline(myfiles,lines);
s.VerifInc(lines);
}
s.RESTerme(2); //here the problem
//sof it's a test...
sof=s.CompTerme("david");
cout << sof<<"occurence du mot david"<<endl;
sof=s.CompTerme("caca");
cout << sof<<"occurence du mot caca"<<endl;
sof=s.CompTerme("People");
cout << sof<<"occurence du mot people"<<endl;
sof=s.CompTerme("sara");
cout << sof<<"occurence du mot sara"<<endl;
sof=s.CompTerme("zozo");
cout << sof<<"occurence du mot zozo"<<endl;
sof=s.CompTerme("sofian");
cout << sof<<"occurence du mot sofian"<<endl;
sof=s.CompTerme("boob");
cout << sof<<"occurence du mot boob"<<endl;
myfiles.close();
}
}