Write a C++ function display prototyped by int display(char ch, int n); that dis
ID: 3640970 • Letter: W
Question
Write a C++ function display prototyped byint display(char ch, int n);
that displays the character ch on the stdout device (screen) consecutively n times if n>0 and displays nothings if n=0. When n>0 and ch is not the blank character, the function will also display an additional newline at the end. The function display returns the actual number of characters (excluding the possible newline at the end) displayed.
Write a driver program, making use of the above specified function display, that line by line repeatedly display the character pattern
*
**
***
****
*****
******
*******
********
*********
**********
++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+
until a given nubmer of non-whitespace characters are displayed. In other words, the program will first ask the user to enter the total number, say target, of non-whitespace characters to be displayed, and then it will repeatedly display the above pattern until exactly target non-whitespace characters are displayed. For instance, if target is entered as 150, then the program will produce the following output (containing exactly 150 non-whitespace characters) afterwards:
*
**
***
****
*****
******
*******
********
*********
**********
++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+
*
**
***
****
*****
******
*******
********
****