Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Show each of the following steps in C++, please. 1. Allocate an array of ten ints on the free store using new. 2. Print the
Show each of the following steps in C++, please.
1. Allocate an array of ten ints on the free store using new. 2. Print the values of the ten ints to cout. 3. Deallocate the array (using deletel]) 4. Write a fiunetion print array10(ostream& os, int* a) that prints out the values of a (assumed to have ten elements) to OS. 5. Allocate an array often ints on the free store; initialize it with the values 100, 101, 102, etc.; and print out its values. 6. Allocate an array of 11 ints on the free store; initialize with the values 100, 101, 102, etc; and print out its values. 7. Write a function print array(ostream& os, int* a, int n) that prints out the values of a (assumed to have n elements) m& os, int a, int n) that prints out the values of a (assuuned to have n elements) to os. S. Allocate an army of 20 ints on the fic soe: initaliz h the values 100, 101, 102. ete: and print our its valnes 9. Did you remember to delete the arrays? (If not, do it) 10. Do 5, 6, and S using a vector instead of an array and a print vector0 instend of print arrayd 1. Allocate an array of ten ints on the free store using new. 2. Print the values of the ten ints to cout. 3. Deallocate the array (using deletel]) 4. Write a fiunetion print array10(ostream& os, int* a) that prints out the values of a (assumed to have ten elements) to OS. 5. Allocate an array often ints on the free store; initialize it with the values 100, 101, 102, etc.; and print out its values. 6. Allocate an array of 11 ints on the free store; initialize with the values 100, 101, 102, etc; and print out its values. 7. Write a function print array(ostream& os, int* a, int n) that prints out the values of a (assumed to have n elements) m& os, int a, int n) that prints out the values of a (assuuned to have n elements) to os. S. Allocate an army of 20 ints on the fic soe: initaliz h the values 100, 101, 102. ete: and print our its valnes 9. Did you remember to delete the arrays? (If not, do it) 10. Do 5, 6, and S using a vector instead of an array and a print vector0 instend of print arraydStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started