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: , ,

Related Posts:

  • pattern_rectangle /* program to print following pattern *********************** *                     * *                     * *&… Read More
  • pattern_nested loops /* program in c to print following pattern... &  &  &  &  &  &  &    &  &  &  &  &       … Read More
  • Fibonacci series /*       program to generate Fibonacci series in C++.  */   #include<iostream.h>#include<conio.h>int main(){clrscr();unsigned long first,second,third,n;first=0; second=… Read More
  • Inverse_matrix /*   program to find inverse of a matrix...   */ #include<stdio.h> int main() {   int a[3][3],i,j;   float determinant=0;   printf("Enter the 9 elements of matrix: "… Read More
  • Prime_Composite /* program to check entered number is prime or composite....   */ #include<iostream.h> #include<conio.h> void main() { int n,i=2,a=0; clrscr(); cout<<"Enter th number=… Read More

0 comments:

Post a Comment

Copyright © 2025 UPgradeCODING | Powered by Blogger