===========================================================================
CODING
#include<all.h>
void main()
{
int i,a,g=1,q,l;
char n[80],m[80];
clrscr();
cout<<"Enter Paragraph: \n";
gets(n);
cout<<"\nEnter any substring to search: ";
gets(m);
textcolor(YELLOW);
cout<<"\n\n";
cprintf("RESULT:- ");
cout<<"\n";
textcolor(5);
for(i=0;n[i]!='\0';i++,g=1)
{
for(q=0,a=i,l=i;m[q]!='\0';q++,a++)
{
if(n[a]!=m[q])
{
g=0;
}
l++;
}
if(g==1)
{
textcolor(GREEN+BLINK);
cprintf("%s",m);
i=l-1;
}
else
{
textcolor(5);
cprintf("%c",n[i]);
}
}
getch();
}
CODING
#include<all.h>
void main()
{
int i,a,g=1,q,l;
char n[80],m[80];
clrscr();
cout<<"Enter Paragraph: \n";
gets(n);
cout<<"\nEnter any substring to search: ";
gets(m);
textcolor(YELLOW);
cout<<"\n\n";
cprintf("RESULT:- ");
cout<<"\n";
textcolor(5);
for(i=0;n[i]!='\0';i++,g=1)
{
for(q=0,a=i,l=i;m[q]!='\0';q++,a++)
{
if(n[a]!=m[q])
{
g=0;
}
l++;
}
if(g==1)
{
textcolor(GREEN+BLINK);
cprintf("%s",m);
i=l-1;
}
else
{
textcolor(5);
cprintf("%c",n[i]);
}
}
getch();
}
===========================================================================
No comments:
Post a Comment