Hi All,
Need expert to teach me how to solve the below C++ questions.
Thanks
(a) void Triangle (int, char)
The function takes in two arguments, the integer representing the base and height; and the character representing either original or mirror. These values are use to print the triangle. For e.g. Triangle (5, ‘O’) will display the triangle as shown in Table Q3(a)(i), Triangle (5, ‘M’) will display the triangle as shown in Table Q3(a)(ii).
Row and Column 5*5.
*
**
***
****
*****
Table Q3(a)(i)
....*
...**
..***
.****
*****
Table Q3(a)(ii)
(b) void extractWord (string& str)
The function extracts the word between ‘*’. For example, using the three test cases below:
string s = "This is to be *reversed*";
string s1 ="*Reversed* starts here";
string s2 = "This is *in* the middle";
and after each function call,
s = reversed
s1 = Reversed
s2 = in
Note: You may assume that there is only one pair of ‘*’.
(c) void modifiedString (string& inStr1)
The function will perform the following:
If the length of inStr1 is even, it will replace all the even position of the text with ‘#’. If the string is odd, there is no replacement. Note that the spaces between words in the string are included in the length of the line of text. (See examples below)
Even Length:
inStr1 = "House Sale";
modified inStr1 = H#u#e#S#l#
Odd Length:
inStr1 = House on Sale
there is no change in inStr1.