Can u help me with this program?
Can u help me with this program?
//program to print the longest word in a string
#include
#include
#include
#include
class st {
private: char ch[30],b[30];
int max,l,length,len,k;
public:
int get();
int find(int);
int print(int,int);
};
int st::get()
{ l=0;
cout<<"enter the string: ";
gets(ch);
strcat(ch," ");
l=strlen(ch);
return l;
}
int st::find(int a)
{ max=0,length=0,len=0;
for(int i=0;i<=a;i++)
{
if(ch[i]!=' ')
{ b[k]=ch[i];
k++;
length++;
}
else
{
b[k]='\0';
if(max
{ max=k;
len=length;
}
k=0;
}
}
return max,len;
}
int st::print(int y,int z)
{ for(int h=z-y;h<=z;h++)
{ cout<
}
return 0;
}
void main()
{
clrscr();
st hi;
int u=0,v=0,w=0,x=0;
u=hi.get();
v=hi.find(u);
w=hi.find(u);
hi.print(v,w);
getch();
}
//hi friend, i m not getting the output of this program properly, there a no compile time errors plz help
2007-02-23
17:55:02
·
1 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Software