Question: If the word variable contains the string Bells, which of the following statements will change the contents of the variable to Bell? a. word.erase(word.length()

If the word variable contains the string “Bells”, which of the following statements will change the contents of the variable to “Bell”?

a. word.erase(word.length() – 1, 1);

b. word.replace(word.length() – 1, 1, "");

c. word = word.substr(0, word.length() – 1);

d. all of the above

Step by Step Solution

3.45 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

d Al... View full answer

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 An Introduction Programming Questions!