GaltonBoard Requirements In the starter code you will find a program to simulate a Galton Board. The code for the simulation is given. It assumes these formal parameters: a Galton Board, the board size and the number of tests to run. Function stubs are provided for the following functions: - int** createNewBoard (int rows); - void dislay (int* board[], int rows); - void freeBoard (int* board [], int rows) ; You must fill in the details of the function stubs to dynamically allocate the board, display it and free it once the program is done using it. This will allow you to practice dynamic allocation and deletion of a 2-dimensional jagged array. Directions The original problem can be found in Big C++ 3ed chapter 7.5. Read chapter sections 7.1 - 7.4 for supporting content on pointers and dynamic allocation (though 7.3 is not needed for this assignment, it will be needed later). The lectures and narrated power points with more details are on Blackboard. - int** createNewBoard (int rows); Dynamically allocate the board array using the new operator that we learned about in class. Then loop to allocate the individual rows. Don't forget to initialize the array elements to 0. This can be done directly when allocating the arrays (the same as if statically allocated) or in a loop afterwards. - void dislay (int* board[], int rows); Display the individual values in a row of the array on a single line spaced 4 characters apart using setw(4) as part of the cout statement. - void freeBoard (int* board [], int rows); Deallocate the Galton board now that we're done using it. Use the delete operator that we learned about in class. Remember the order that we deallocate is the reverse order that we used to create the board. Sample Use Case Enter the size of the board: 7 Enter the number of tests: 500 Enter the random seed: 17 500 248 252 135 239 126 72 188 182 58 36 132 177 124 31 19 71 180 139 71 20 7 45 130 155 105 46 12

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Code Should Be In C++

GaltonBoard Requirements
In the starter code you will find a program to simulate a Galton Board. The code for the simulation is
given. It assumes these formal parameters: a Galton Board, the board size and the number of tests to run.
Function stubs are provided for the following functions:
- int** createNewBoard (int rows);
- void dislay (int* board[], int rows);
- void freeBoard (int* board[], int rows);
You must fill in the details of the function stubs to dynamically allocate the board, display it and free it
once the program is done using it. This will allow you to practice dynamic allocation and deletion of a
2-dimensional jagged array.
Directions
The original problem can be found in Big C++ 3ed chapter 7.5. Read chapter sections 7.1 - 7.4 for
supporting content on pointers and dynamic allocation (though 7.3 is not needed for this assignment, it
will be needed later). The lectures and narrated power points with more details are on Blackboard.
- int** createNewBoard (int rows);
Dynamically allocate the board array using the new operator that we learned about in class. Then loop to
allocate the individual rows. Don't forget to initialize the array elements to 0. This can be done directly
when allocating the arrays (the same as if statically allocated) or in a loop afterwards.
- void dislay (int* board[], int rows);
Display the individual values in a row of the array on a single line spaced 4 characters apart using setw(4)
as part of the cout statement.
- void freeBoard (int* board [], int rows);
Deallocate the Galton board now that we're done using it. Use the delete operator that we learned about in
class. Remember the order that we deallocate is the reverse order that we used to create the board.
Sample Use Case
Enter the size of the board: 7
Enter the number of tests: 500
Enter the random seed: 17
500
248 252
135 239 126
72 188 182 58
36 132 177 124 31
19 71 180 139 71 20
7 45 130 155 105 46 12
Transcribed Image Text:GaltonBoard Requirements In the starter code you will find a program to simulate a Galton Board. The code for the simulation is given. It assumes these formal parameters: a Galton Board, the board size and the number of tests to run. Function stubs are provided for the following functions: - int** createNewBoard (int rows); - void dislay (int* board[], int rows); - void freeBoard (int* board[], int rows); You must fill in the details of the function stubs to dynamically allocate the board, display it and free it once the program is done using it. This will allow you to practice dynamic allocation and deletion of a 2-dimensional jagged array. Directions The original problem can be found in Big C++ 3ed chapter 7.5. Read chapter sections 7.1 - 7.4 for supporting content on pointers and dynamic allocation (though 7.3 is not needed for this assignment, it will be needed later). The lectures and narrated power points with more details are on Blackboard. - int** createNewBoard (int rows); Dynamically allocate the board array using the new operator that we learned about in class. Then loop to allocate the individual rows. Don't forget to initialize the array elements to 0. This can be done directly when allocating the arrays (the same as if statically allocated) or in a loop afterwards. - void dislay (int* board[], int rows); Display the individual values in a row of the array on a single line spaced 4 characters apart using setw(4) as part of the cout statement. - void freeBoard (int* board [], int rows); Deallocate the Galton board now that we're done using it. Use the delete operator that we learned about in class. Remember the order that we deallocate is the reverse order that we used to create the board. Sample Use Case Enter the size of the board: 7 Enter the number of tests: 500 Enter the random seed: 17 500 248 252 135 239 126 72 188 182 58 36 132 177 124 31 19 71 180 139 71 20 7 45 130 155 105 46 12
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education