// short program that manipulates a mix of int variables, int pointers, int // references, string pointers, and string objects #include #include using namespace std; int main() { int x = 13; int y = 28; int * p = nullptr; cout << "x = " << x << ", y = " << y << ", p = " << p << endl; cout << endl; p = &x; *p *= 2; cout << "x = " << x << ", y = " << y << ", p = " << p << endl; cout << endl; p = &y; *p = *p + 10; (*p)++; cout << "x = " << x << ", y = " << y << ", p = " << p << endl; cout << endl; int & a = x; a = a * 3; cout << "x = " << x << endl; cout << &x << " " << &a << endl; cout << endl; p = new int(42); cout << "p = " << p << endl; const char * text = "hello there"; string s = text; cout << "s = " << s << endl; cout << "s address = " << &s << endl; cout << endl; string * p2 = &s; cout << "p2 = " << p2 << endl; cout << (*p2).size() << endl; (*p2)[1] = '*'; cout << "s = " << s << endl; return 0; }