10 Mar 2013

Delete SUBSTRING

/*

program to delete a part of string....

*/

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
 

void main()
{
 

clrscr();
char str[80];
int a,b,c,i,j,k,len=0;
 

cout<<"Enter the string:";
gets(str);
cout<<endl<<"Enter the starting position of the substring to be deleted:";
cin>>k;
cout<<endl<<"Enter the range of deletion:";
cin>>j;
for(i=0;str[i]<='\0';i++)
 {
  c=len++;
 }
for(a=k;str[a]!='\0';a++)
 str[a]=str[a+j];
 cout<<endl<<"The new string is:"<<str;
 

getch();
}

Categories: , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger