Cách chèn một chuỗi vào một chuỗi khác C++

Sự miêu tả

If a string is inserted into a text. Then newer string is the collection 
all characters present in both the string.
Example : 
  Input : 
      text : whatthat
      string : is
      index : 4
  
  Output : whatisthat

C/C++

/* C program to insert a string into given string */
//Save it as InsertString.c

#include
#include
int main[]{

    char str[100], insertStr[50], newStr[100];
    int i, pos;

    printf["Enter a string : "];
    gets[str];

    printf["Enter a string to be inserted : "];
    gets[insertStr];

    printf["Enter the position at which string to be inserted : "];
    scanf["%d",&pos];

    int j=0;

	
    /*Insert elements of string into new string upto index 
	  pos from start */
	
    for[i=0;i

Chủ Đề