Answer to Question #255162 in C++ for jersonjangerona

Question #255162
Prepare a c++ program of the following. a.) Display the phrase “ sing a song “ b.) After displaying the phrase “ sing a song “ change the eleventh character to “ s “ and find the result. c.) Find song in the phrase. d.) Delete the whole phrase and display the message “ Bye phrase you are now officially deleted.”
1
Expert's answer
2021-10-22T07:39:56-0400
#include<iostream>
#include<string>
using namespace std;
int main(){
	string song = "sing a song";
	cout<<song<<endl;
	string rep = "s";
song.replace(11,1,rep);
cout<<song<<endl;
cout<<song.find("song")<<endl;
song.clear();
cout<<song<<endl;
cout<<"Bye phrase you are now officially deleted!\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS