3 Functions with Value Parameters Use program BoxesWithFunction for Exercises 3-4. Program Boxes WithFunction is the shell of a program that prompts the user to enter an integer number. When completed, this number is read and passed to function Print as parameter numSigns. The function prints a box of dollar signs on the screen that is numSigns by (numSigns / 2) in dimension. For example, if numSigns is 10, the following box is printed on the screen: ssssssssss SSSsssssss Note the interior dimensions are (numSigns - 2) by (numSigns / 2- 2). // Program BoxesWithFunction prompts for the number of dollar signs // for the top of the box. // printed with dollar signs on the sides. That number/ 2-2 1ines are #include using namespace std; void Print (int numSigns); int main () int number; cout <« "Enter the number of dollar signs for the top; " « "press return."; cout <« "Enter a negative number to quit."<> number; while (number>=0) /* FILL IN call to Print */ cout << "Enter the number of dollar signs for the top; " « "press return."; cout « "Enter a negative number to quit."<> number; return 0; void Print (int numsigns) // FILL IN documentation. /* FILL IN code to print numSigns S's */ /* FILL IN code to print (numsigns / 2)-2 lines with /* S's lining up under the left-most and right-most /* $ ones on the top line. /* FILL IN code to print numsigns $'s Exercise 3. Fill in the missing code in function Print and the invoking statement in function main. Compile and run your program using 4, 10, and 7 as input data. Don't forget to fill in documentation for the function. Exercise 4: Rewrite your solution to Exercise 3 so that the symbol used as the border is also read as data and passed to function Print as a parameter. To make the symbol be a parameter requires the following changes: • Prompt for and read the symbol. • Add the symbol and its type (or just the type) to the parameter list of the function prototype. • Add the symbol and its type to the parameter list of the function definition. Use the parameter instead of 'S' in the body of the function definition. • Add the symbol to the argument list. Run the program three times using &, %, and A as symbols and 4, 10, and 7 as the number of symbols to use.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question
Can anyone help me with these coding questions please
3 Functions with Value Parameters
Use program BoxesWithFunction for Exercises 3-4. Program Boxes WithFunction is the shell of a
program that prompts the user to enter an integer number. When completed, this number is read and
passed to function Print as parameter numSigns. The function prints a box of dollar signs on the screen
that is numSigns by (numSigns / 2) in dimension. For example, if numSigns is 10, the following box is
printed on the screen:
sssssssss
%24
SSSsssssss
Note the interior dimensions are (numSigns – 2) by (numSigns / 2 - 2).
// Program BoxesWithFunction prompts for the number of dollar signs
// for the top of the box.
// printed with dollar signs on the sides.
That number / 2 - 2 1ines are
#include <iostream>
using namespace std;
void Print (int numsigns);
int main ()
int
number;
cout <« "Enter the number of dollar signs for the top;
<< "press return.";
cout <« "Enter a negative number to quit."<<endl;
cin >> number;
while (number>=0)
/* FILL IN call to Print */
cout << "Enter the number of dollar signs for the top; "
<< "press return.";
cout << "Enter a negative number to quit."<<endl;
cin >> number;
return 0;
//*****
void Print (int numSigns)
// FILL IN documentation.
/* FILL IN code to print numSigns $'s */
/* FILL IN code to print (numsigns / 2)-2 lines with
/* $'s lining up under the left-most and right-most
/* $ ones on the top line.
/* FILL IN code to print numSigns $'s
Exercise 3.
Fill in the missing code in function Print and the invoking statement in function main. Compile and run
your program using 4, 10, and 7 as input data. Don't forget to fill in documentation for the function.
Exercise 4:
Rewrite your solution to Exercise 3 so that the symbol used as the border is also read as data and passed
to function Print as a parameter. To make the symbol be a parameter requires the following changes:
• Prompt for and read the symbol.
• Add the symbol and its type (or just the type) to the parameter list of the function prototype.
• Add the symbol and its type to the parameter list of the function definition. Use the parameter instead of
'S' in the body of the function definition.
• Add the symbol to the argument list.
Run the program three times using &, %, and A as symbols and 4, 10, and 7 as the number of symbols to
use.
Transcribed Image Text:3 Functions with Value Parameters Use program BoxesWithFunction for Exercises 3-4. Program Boxes WithFunction is the shell of a program that prompts the user to enter an integer number. When completed, this number is read and passed to function Print as parameter numSigns. The function prints a box of dollar signs on the screen that is numSigns by (numSigns / 2) in dimension. For example, if numSigns is 10, the following box is printed on the screen: sssssssss %24 SSSsssssss Note the interior dimensions are (numSigns – 2) by (numSigns / 2 - 2). // Program BoxesWithFunction prompts for the number of dollar signs // for the top of the box. // printed with dollar signs on the sides. That number / 2 - 2 1ines are #include <iostream> using namespace std; void Print (int numsigns); int main () int number; cout <« "Enter the number of dollar signs for the top; << "press return."; cout <« "Enter a negative number to quit."<<endl; cin >> number; while (number>=0) /* FILL IN call to Print */ cout << "Enter the number of dollar signs for the top; " << "press return."; cout << "Enter a negative number to quit."<<endl; cin >> number; return 0; //***** void Print (int numSigns) // FILL IN documentation. /* FILL IN code to print numSigns $'s */ /* FILL IN code to print (numsigns / 2)-2 lines with /* $'s lining up under the left-most and right-most /* $ ones on the top line. /* FILL IN code to print numSigns $'s Exercise 3. Fill in the missing code in function Print and the invoking statement in function main. Compile and run your program using 4, 10, and 7 as input data. Don't forget to fill in documentation for the function. Exercise 4: Rewrite your solution to Exercise 3 so that the symbol used as the border is also read as data and passed to function Print as a parameter. To make the symbol be a parameter requires the following changes: • Prompt for and read the symbol. • Add the symbol and its type (or just the type) to the parameter list of the function prototype. • Add the symbol and its type to the parameter list of the function definition. Use the parameter instead of 'S' in the body of the function definition. • Add the symbol to the argument list. Run the program three times using &, %, and A as symbols and 4, 10, and 7 as the number of symbols to use.
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,