C++ 6.42 LAB: Warm up: Text analyzer & modifier
6.42 LAB: Warm up: Text analyzer & modifier (1) 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 main(), call the GetNumOfCharacters() function and then output the returned result. (1 pt) (4) Implement the Output WithoutWhitespace() function. OutputWithoutWhitespace() outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the Output Without Whitespace() function in main(). (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: The onlythingwehavetofearisfearitself.
LAB ACTIVITY 6.42.1: LAB: Warm up: Text analyzer & modifier 1 #include 2 #include 3 using namespace std; 4 5 //Returns the number of characters in usrStr 6 int GetNumOfCharacters (const string usrStr) { 7 8 /* Type your code here. */ 9 10 } 11 12 int main() { 13 14 /* Type your code here. */ 15 16 return 0; 17 } main.cpp 0/6 Load default template...
C++ 6.42 LAB: Warm up: Text analyzer & modifier
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am