Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please fill in the planks and please make sure it works on C++ because I going crazy with that ----------------------------------------------------------------------------------------------------------------------------------------------------------- // Creating 2-D dynamically allocated

Please fill in the planks

and please make sure it works on C++ because I going crazy with that

-----------------------------------------------------------------------------------------------------------------------------------------------------------

// Creating 2-D dynamically allocated arrays // 7.4 Generate circle #include #include

using namespace std;

void displayCircle(char **, int, int); void computeCircle(int, char **, int, int, char*); // FILL IN THE CODE with the two missing prototypes: // and

int main() { int rows, cols; cout << "Number of rows and columns: "; cin >> rows >> cols; char symbol; cout << "Enter character symbol: "; cin >> symbol; // Create 2-D dynamically allocated array // Clear array // FILL IN THE CODE to call the function with arguments // , , and // Compute Circle int radius; if (rows function with arguments // , , , , and (address of) // Display Circle // FILL IN THE CODE to call the function with arguments // , , and // Deallocate array // FILL IN THE CODE for a loop for i=0,1,...,rows-1 that deallocate each // at index // FILL IN THE CODE that deallocate return 0; }

// FILL IN THE CODE for a function called that returns // a pointer to a character pointer (use two *). It has two parameters: // an integer called and an integer called . // The function should contain the following:

// FILL IN THE CODE to define a pointer to a character pointer (use two *) // called and initialize it to the null pointer // FILL IN THE CODE that if and are greater than 0 it executes // the following: // 1. FILL IN THE CODE to dynamically allocate an array of pointers // of size and assigns it to // 2. FILL IN THE CODE for a loop for i=0,1,...,rows-1 that sets each // at index a dynamically allocated array of characters // of size

void clearArray(char **arr, int rows, int cols) { int r = 0; while (r

// FILL IN THE CODE for a function called of void type. // It has four parameters: a pointer to character pointer called , // an integer called and an integer called . // The function should contain the following:

void displayCircle(char **arr, int rows, int cols) {

// FILL IN THE CODE for a loop over all the rows and columns // that outputs at and . The characters in a row should // appear consecutively. At the end of each row, a new line character // should be printed. Follow the function as example.

}

const float TWO_PI = 6.28318530717959; void computeCircle(int radius, char **arr, int rows, int cols, char* symb) { float da = TWO_PI/(4*radius); // angle steps in radians int r0 = rows/2; // screen center row int c0 = cols/2; // screen center col int r,c; float a = 0; while (a < TWO_PI) { r = r0 + radius*cos(a); c = c0 + radius*sin(a); // FILL IN THE CODE that sets at indexes and to the // dereferenced value of only if and are within bounds, // that between their minimum and maximum values

a = a + da; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

were correct), and

Answered: 1 week ago

Question

KEY QUESTION Refer to Figure 3.6, page

Answered: 1 week ago