Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED . Q2: Text Analysis The availability of computers with string-manipulation capabilities

image text in transcribed

IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED .

Q2: Text Analysis The availability of computers with string-manipulation capabilities has resulted in some rather interesting approaches to analyzing the writings of great authors. This exercise examines three methods for analyzing texts with a computer. You have to use char * for the following exercises. 1. Write a function that receives a string consisting of several lines of text and returns an array indicating the number of occurrences of each letter of the alphabet in the text. For example, the phrase "To be, or not to be that is the question": contains one "a," two "b's," no "c's," and so on. i void count Letters (char *string, int *&array, int & size) 2 /* Parameters: 3 Input: 4 char * : a multiline string 5 Output: 6 int *: an array containing counts of each letter, 7 to be allocated in function 8 int : array size */ 9 { 10 } 2. Write a function that receives a string consisting of several lines of text and returns an array indicating the number of one-letter words, two-letter words, three-letter words, and so on, appearing in the text. For example, the phrase "Whether this nobler in the mind to suffer" contains 2, 3, 4, etc. length words. i void count WordsBased OnLength(char *string, int *&array/*to be allocated */, 2 int & size /* updated array size*/) 3 / * Parameters: 4 Input: 5 char * : a multi-line string 6 Output: 7 int *: an array containing counts of each different length words, 8 to be allocated in function 9 int : array size */ 10 { 11 } 3. Write a function that receives a string consisting of several lines of text and returns arrays indicating unique words and the number of occurrences of each unique word in the text along with their size. 1 void counting Unique Words (char *string, char **&uwords/ *list of unique words; *), 2 int *&array /*to be allocated */, int & size /*updated array size*/) 3 / * Parameters: 4 Input : 5 char * : a multiline string 6 Output: 7 char **: an array of unique words 8 int *: their counts 9 int : number of unique words*/ 10 { 11 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions