Question
Programming Language:C++ OOP Text Analysis: The availability of computers with string-manipulation capabilities has resulted in some rather interesting approaches to analyzing the writings of great
Programming Language:C++ OOP
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 two methods for analyzing texts with a computer. You have to use char * for following exercises.
1. Write a function which remove punctuations marks (.~ ! @ # $ % ^ & * ( ) _ + = ; : / ?) from the paragraph.
Note: Remember
i) Output must only contain alphabets and space characters.
ii) There must be single space between two words.
void removePunctuation(char *str)
/* This function receives string (char*)
And remove punctuation marks.
*/
{
}
Example:
Input: To be, or not to be: that is the question:
Output: To be or not to be that is the question
2. Write a function that receives a string consisting of several lines of text (paragraph) and
returns an array indicating the number of occurrences of each letter of the alphabet in the
text.
void countLetters(char* str, int*& array, int & size)
/* Parameters:
Input:
Char* str: a multiline string. E.g., This is a test String
Output:
int *: arr should contain the frequency of characters given in sequence of original
character array.
i-e
Index 0 contains frequency of 'T' //case sensitive
Frequency of T is 1
Index 1 contains frequency of 'h'
Frequency of h is 1
Index 2 contains frequency of 'i'
Frequency of i is 3
Index 3 contains frequency of 's'
Frequency of s is 2
Index 4 contains frequency of ' '(space)
Frequency of is 4
Index 5 contains frequency of 'a'
Frequency of a is 1
Index 6 contains frequency of 't'
Frequency of t is 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started