Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Can anyone help me with these coding questions please
# Functions with Value Parameters

Use program **BoxesWithFunction** for Exercises 3-4. Program **BoxesWithFunction** 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:

```
$$$$$$$$$$
$        $
$        $
$$$$$$$$$$
```

Note the interior dimensions are `(numSigns – 2)` by `(numSigns / 2 – 2)`.

```cpp
// Program BoxesWithFunction prompts for the number of dollar signs
// for the top of the box. That number / 2 - 2  lines are
// printed with dollar signs on the sides.

#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
expand button
Transcribed Image Text:# Functions with Value Parameters Use program **BoxesWithFunction** for Exercises 3-4. Program **BoxesWithFunction** 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: ``` $$$$$$$$$$ $ $ $ $ $$$$$$$$$$ ``` Note the interior dimensions are `(numSigns – 2)` by `(numSigns / 2 – 2)`. ```cpp // Program BoxesWithFunction prompts for the number of dollar signs // for the top of the box. That number / 2 - 2 lines are // printed with dollar signs on the sides. #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
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education