===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int i,j,Yes;
char b[80],a[80];
first();
second();
first();
cprintf("Enter Paragraph: ");
gets(a);
for(i=0,Yes=0;a[i]!='\0';i++)
{
if(a[i+1]=='\0' && Yes==0)
{
a[i+1]=' ';
a[i+2]='\0';
Yes=1;
}
}
cprintf("\r\nEnter Word to Search: ");
gets(b);
cprintf("\r\n");
for(i=0;a[i]!='\0';i++)
{
if(a[i-1]==' ' || i==0)
{
for(j=0,Yes=1;b[j]!='\0';j++)
{
if(a[i+j]!=b[j])
{
Yes=0;
break;
}
if(b[j]==' ')
{
a[i+j]=' ';
}
}
if(Yes==1 && a[j+i]==' ')
textcolor(YELLOW+BLINK);
else
textcolor(WHITE);
}
if(a[i]==' ')
cprintf(" ");
else
cprintf("%c",a[i]);
}
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int i,j,Yes;
char b[80],a[80];
first();
second();
first();
cprintf("Enter Paragraph: ");
gets(a);
for(i=0,Yes=0;a[i]!='\0';i++)
{
if(a[i+1]=='\0' && Yes==0)
{
a[i+1]=' ';
a[i+2]='\0';
Yes=1;
}
}
cprintf("\r\nEnter Word to Search: ");
gets(b);
cprintf("\r\n");
for(i=0;a[i]!='\0';i++)
{
if(a[i-1]==' ' || i==0)
{
for(j=0,Yes=1;b[j]!='\0';j++)
{
if(a[i+j]!=b[j])
{
Yes=0;
break;
}
if(b[j]==' ')
{
a[i+j]=' ';
}
}
if(Yes==1 && a[j+i]==' ')
textcolor(YELLOW+BLINK);
else
textcolor(WHITE);
}
if(a[i]==' ')
cprintf(" ");
else
cprintf("%c",a[i]);
}
getch();
}
===========================================================================
No comments:
Post a Comment