Who's Online

We have 30 guests and 1 member online

Login Form



RSS FEEDS



Sub-String Deletion PDF Print
User Rating: / 0
PoorBest 
Program Codes - C++ Programming
Written by Mansoorkhan   
Friday, 06 November 2009 03:04

#include
#include
#include
main()
{
clrscr();
int l,i,j=0,z=0,k=0;
char a[200]="",b[20];
printf("\n\n enter the string:");

for(i=0;a[i-1]!='\n';i++)
a[i]=getchar();
a[i]='$';
printf("\n\n enter the word to be found:");
scanf("%s",b);
l=strlen(b);
for(i=0;a[i]!='$';i++)
{
if(a[i]==b[0]||z==0)
{
j=0;
k=0;
z=1;
}
if(a[i]!=b[j])
{
k++;
i--;
}
j++;
if(k==0&&j==l)
break;

}
if(k==0)
{
for(i=w;a[i]!='$';i++)
a[i]=a[i+l];
a[i]='$';
}
else
printf("\n ###not found###");


printf("\n\n\tEdied String : ");
for(i=0;a[i]!='$';i++)
printf("%c",a[i]);
getch();
}

AddThis Social Bookmark Button
 

Copyright Disclaimer: This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.Thanks to Getkerala

For Latest Technology News and computer tips and tricks