Given a string variable string s ; , initialize s such that it contains a paragraph
FOR MORE CLASSES VISIT www . tutorialoutlet . com
---------------------------------------------------------------------------------------
Given a string variable string s ; , initialize s such that it contains a paragraph
FOR MORE CLASSES VISIT www . tutorialoutlet . com
�
Problem description : Given a string variablestring s ;, initializessuch that it contains a paragraph in English text . You can do so within your program by either ( 1 ) hardcoding the initial value , e . g ., string s (" hello world "); or ( 2 ) read in the initial value from the keyboard by calling thegetline ( ) function . Furthermore , this paragraph consists of no more than 100 tokens . Tokens are sequences of contiguous characters separated by any of the specified delimiters ( e . g ., white spaces ). Please implement a C ++ program to perform the following two tasks ons :
1 . Implement the functionvoidgetLetterFreq ( string s ); to identify the frequency of each unique letter (' a ' - ' z ', case insensitive ) ins . This function will call the " cout <<" statement ( s ) to print out the frequencies on the screen .
2 . Implement the function void StrToTokens ( string s ); to identify and print all the tokens contained inson the standard output ( i . e ., cout ). For simplicity , only white spaces will be considered as delimiters . For instance , the string " what ' s that thing ?" contains three tokens : " what ' s ", " that " and " thing ?". Youare not allowed to call existing functions such as strtok () for this task . Specifically , you are required to loop through the input string one character at a time to separate the input string to different tokens . Please store the tokens in an array ( such as vector < string >) before printing out all the tokens .