About

Kannur University btech CSE study materials, question papers, syllabus . . .

Thursday, July 4, 2013

S4 HARDWARE LAB - TASM -SUBSTRING SEARCHING AND DELETING

                    SUBSTRING SEARCHING AND DELETING
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{int l,I,k,j;
char str[100],ss[50],ms[100][100],ch[20]={‘\0’};
J=0,k=0;
clrscr();
Printf(“enter the string”);
gets(str);
l=strlen(str);
printf(“enter the string to b searched”);
gets(ss);
for(i=0;i<=l;i++)
{if(str[i]!=’ ‘)
{ms[j][k]=str[i];
k++;
}
else
{ms[j][k]=’\0’;
J++;
K=0;
}
}
ms[j][k]=’\0’;
for(i=0;i<=j;i++)
{if(strcmp(ms[i],ss)==00)
{printf(“the searched string is present”);
Strcpy(ms[i],ch);
}
}
Printf(“the string after deletion”);
for(i=0;i<=j;i++)
Printf(“%s”ms[i]);
getch();
}
OUTPUT
Enter a string:
God bless you
Enter the string to be searched:
Bless
The searched string is present:

The string after deletion is god you

0 comments:

Post a Comment