Question: ( 5 pts ) Part 3 : Handling C + + String functions Create a function named part 3 that is invoked from the main

(5 pts) Part 3: Handling C++ String functions
Create a function named part3 that is invoked from the main function and the prototype is void part3(). Write function body with the following requirements:
Declare both str1 and str2 variables:
string str1="C++ is a Swiss pocketknife of programming language.";
string str2= "has been called";
Display the content of str1 and str2. Print the number of characters in str1 and str2.
Extract the 12 characters starting from position 9 in str1 and display them.
Insert "computer" into str1 starting at the 31st position and display the contents of variable str1.
Starting from the 4th position of str1, replace 4 characters with str2. Display the contents of str1.
Remove 9 characters starting from position 42 in str1. Display the contents of str1.
Sample Output
( 5 pts ) Part 3 : Handling C + + String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!