subject

Prompt the user to enter a string of their choosing. output the string. (1 pt) ex: enter a sentence or phrase: the only thing we have to fear is fear itself. you entered: the only thing we have to fear is fear itself.(2) complete the getnumofcharacters() function, which returns the number of characters in the user's string. we encourage you to use a for loop in this function. (2 pts)(3) in call the getnumofcharacters() function and then output the returned result. (1 pt)(4) implement the outputwithoutwhitespace() function. outputwithoutwhitespace() outputs the string's characters except for whitespace (spaces, tabs). note: a tab is '\t'. call the outputwithoutwhitespace() function in (2 pts) ex: enter a sentence or phrase: the only thing we have to fear is fear itself. you entered: the only thing we have to fear is fear itself. number of characters: 46 string with no whitespace: .' c++ c++ c++ is what i have so far: #include #include using namespace std; //returns the number of characters in usrstrint getnumofcharacters(int usrstr) {usercount = usrstr. length(); return usercount; }const outputwithoutwhitespaces(string& ; usrstr) {string text; text = text. replace(" ",""); return text; }int main() {string usrstr; cout < < "enter a sentence or phrase: "; getline(cin, usrstr); cout < < "you entered: " < < usrstr < < endl; int count = getnumofcharacters(); cout < < "number of characters: " < < count < < endl; cout < < "string with no whitespace: " < < outputwithoutwhitespace() < < endl; return 0; }

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:30, anggar20
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, batmandillon21
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
image
Computers and Technology, 24.06.2019 07:20, djs1002
Ingrid started speaking about her slide presentation. when she clicked to th"third slide, which had just a picture of an elephant, she forgot what she wassupposed to talk about. what could ingrid do to avoid this situation in thefuture? oa. print handouts for her audience. ob. add presenter's notes to each slide. oc. add a video to each slide. od. save her slide presentation to a flash drive
Answers: 2
image
Computers and Technology, 24.06.2019 13:30, livie225
Type the correct answer in the box. spell all words correctly. what is the default margin width on all four sides of a document? by default, the document has a margin on all four sides.
Answers: 1
You know the right answer?
Prompt the user to enter a string of their choosing. output the string. (1 pt) ex: enter a sentence...

Questions in other subjects:

Konu
Mathematics, 28.11.2020 03:50
Konu
Social Studies, 28.11.2020 03:50