#include <iostream.h>
#include <string.h>
int *s;
int main ()
{
int i = 0;
float perc;
int appearances = 1;
int size;
s= new int[size];
cout<<"Enter the string: ";
char str[s];
cin.getline(str,size);
int a=strlen(str);
for(i=0;str[i]!='\0';i++)
{
if(str[i]=='t')
{
if(str[i+1]=='h')
{
if(str[i+2]=='e')
{
perc=(100*i)/(a);
cout<<appearances<<" 'the' found when "<<perc<<" % of the file is read"<<endl;
appearances++;
}
}
}
}
cout<<"total of "<<appearances-1 <<" 'the' found"<<endl;
return 0;
}
*1lacca edit: to close a tag, you need a / not a \

New Topic/Question
Reply




MultiQuote






|