Question

a. Write a statement that declares sales to be a pointer to a pointer of type double. b. Write a C++ code that dynamically creates a two-dimensional array of five rows and seven columns and sales contains the base address of that array. c. Write a C++ code that inputs data from the standard input device into the array sales. d. Write a C++ code that deallocates the memory space occupied by the two-dimensional array to which sales points.

Solution

Verified
Answered 1 year ago
Answered 1 year ago
Step 1
1 of 2

a)\textbf{a)}

double** sales;

b)\textbf{b)}

sales = new double* [5]; for(int i = 0; i < 5; i ++) sales[i] = new double[7];

c)\textbf{c)}

for(int i = 0; i < 5; i++) for(int j = 0; j < 7; j++) std::cin >> sales[i][j];

d)\textbf{d)}

for(int i = 0; i < 5; i++) delete[] sales[i] ; delete[] sales;

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

More related questions

1/4

1/7