Q1: String manipulation functions
Write the implementation of the following functions:
Figure 1: A mapping table between English Alphabets and Morse codes. Source: http://en.wikipedia.org/ wiki/Morse code
Q2: Morse Code
Morse code has been one of the most basic communication protocol and still used to convey SOS messages and other urgent communication. In Morse code each English alphabet is encoded by a sequence of β.β and β-β, see Figure 1 for complete mapping between English alphabets and Morse codes. Letters are separated by spaces and words by β/β. Your task is to design a program that can (i)convert any given string into a Morse code sequence char* convertToMorseCode(char*) and (ii) a Morse code sequence to a string. char* convertToString(char*) You are not authorized to use string data type, however you can use char*
Q3: Magic Squares
In this question your goal is to write code for solving magic square (for details read the attached file magicsquare.pdf) using 2-D pointers. Your function should take the the dimension of magic square as input and then solve the magic square for given dimension. You are required to return a 2d pointer to an integer.
Q4: 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 following exercises.
- 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 bs, no cs, and so on.
- 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.
- 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.
Β


