By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 827 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

who can fix my programme

P: 6
I tried to fix my programme but without success . the idea of the programme is to count the occurence of each similar word and their percentage .

the code:

using namespace std;


int main()

ifstream infile ;
ofstream outfile;
char text[300],sec[300];
int x=0,total=1;"sentence.txt");


cout<<"file cannot be found";


if ({

cout<<"file cannot be found";



Ptr1=strtok(text," ");
Ptr2=strtok(sec," ");


while(Ptr2!= NULL){



Ptr2=strtok(NULL," ");


cout<<Ptr1<<" "<<x<<" "<<(x/total)*100<<endl;
outfile<<Ptr1<<" "<<x<<endl;
Ptr1=strtok(NULL," ");

return 0;

Oct 1 '06 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916
You will need to decribe the way in which it is not working. Are you getting any compile or run time errors?
Oct 2 '06 #2

P: 6
i am not getting any compile or runtime errors i just have logical errors .

the due date for this assignment is wednesday 4/10
Oct 2 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.