What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

C/C++ Lab Program(s)/Materials

C Program for SubString.

#include<stdio.h>
#include<conio.h>
void main()
{
char a[30],b[30];
int i,j,l1,l2,c,f;
clrscr();
printf("OUTPUT\n");
printf("------\n");
printf("\n\n");
printf("\nEnter First String:");
scanf("%s",a);
printf("\nEnter String to Search:");
scanf("%s",b);
l1=strlen(a);
l2=strlen(b);
j=0;
c=0;
f=0;
for(i=0;i<l1;i++)
{
x:
if(b[j]==a[i])
{
c++;
f=1;
j++;
if(c==l2)goto y;
}
else
{
if(f==1)
{
j=0;
c=0;
f=0;
goto x;
}
}
}
y:
if(c==l2)
printf("\n\t\tWord Found");
else
printf("\n\t\tWord Not Found");
getch();
}

More Lab Programs with Answers -Given Below-Click and Get Freely

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com