/*======== Fall 2022 - CS 112 Week 6 Lab Exercise - Problem 2 - pointers and dynamic memory allocation compile using: g++ 112lab06-ex.cpp -o 112lab06 run using: ./112lab06 Do NOT remove any of the comments below -- ADD the specified statement(s) after each of them. ========*/ /*--- by: ***PUT BOTH of YOUR NAMES HERE*** last modified: 2022-09-30 ---*/ #include <cstdlib> #include <iostream> #include <string> #include <cmath> using namespace std; int main() { cout << boolalpha; int quantity = 47; //*** DECLARE a pointer to an int named quant_ptr //*** WRITE a statement that causes quant_ptr to point to quantity //*** WRITE a statement, using ONLY quant_ptr, to print to the //*** screen the value that quant_ptr currently points to //*** WRITE a statement, using ONLY quant_ptr, that changes the //*** value quant_ptr is currently pointing to, adding 23 to it //*** WRITE a statement, using ONLY quant_ptr, to print to the //*** screen the value that quant_ptr currently points to cout << "and now, quantity is: " << quantity << endl; cout << endl; //*** DECLARE a pointer to a string named city_ptr //*** WRITE a statement that causes city_ptr to point //*** to an appropriate dynamically-allocated chunk of memory //*** WRITE a statement that causes the memory pointed to by //*** city_ptr to contain the name of a city of your choice // // optional: if you want to ask the user to enter this, // you can add additional statements accordingly //*** WRITE a statement that prints to the screen the value //*** currently pointed to by city_ptr //*** DEALLOCATE/free the memory that city_ptr is pointing to, //*** and then set city_ptr to point to nothing (following //*** CS 112 course coding standards) return EXIT_SUCCESS; }