C++

Objectives :

  • File Name : string_iteration_insert1.cpp
    Insert can split a string
    cout<<"\n----temp string---2----split string 4------------";
    cout<<"\n str4 before split @ 6th :"<< str4 << endl;
    temp="";
    temp = str4.insert( 6, (" " + str3 +" ,Boom Bang"));
    cout <<"\n temp = str4.insert( 6, (' ' + str3 +' ,Boom Bang'))";
    cout<<"\n\t"<< temp <<endl;
  • Code: string_iteration_insert1.txt
 

Step: 1 Create a source file.

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

 

Step: Brief Discussion

The code, temp = str4.insert( 6, (" " + str3 +" ,Boom Bang")), will split the string, "str4" and put the contents of another string ,"str3".