What is the output of the following program? (11) #include #include using namespace std; int main() { string str = "Regular exercise can reduce health insurance cost."; string str1; string str2 =...


What is the output of the following program? (11)


#include #include

using namespace std;


int main()


{



string str = "Regular exercise can reduce health insurance cost.";



string str1;



string str2 = "low fat diet";



string newStr;



string::size_type index;



index = str.find("can");



str1 = str.substr(0, index - 1);



cout <>


newStr = str1 + " and " + str2;



cout <><><>



cout <><><>



index = str.find("health"); newStr = str.substr(index, 17);



cout <><><>



index = str.find("cost"); cout <>



str = "$ocial Nedia!!"; cout <><><>



str[0] = 'S'; index = str.find('N'); str[index] = 'M';



cout <>



return 0;


}





May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here