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
VerifiedAnswered 1 year ago
Answered 1 year ago
Step 1
1 of 2
double** sales;
sales = new double* [5]; for(int i = 0; i < 5; i ++) sales[i] = new double[7];
for(int i = 0; i < 5; i++) for(int j = 0; j < 7; j++) std::cin >> sales[i][j];
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
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
More related questions
1/4
1/7