What are smart pointers? The answer is fairly simple; a smart pointer is a pointer which is smart. What does that mean? Actually, smart pointers are objects which behave like pointers but do more than a pointer. These objects are flexible as pointers and have the advantage of being an object (like constructor and destructors called automatically). A smart pointer is designed to handle the problems caused by using normal pointers (hence called smart).
#include <iostream.h> #include <conio.h> void main() { clrscr(); int x = 10; int y = 2; int sum, difference, product, quotient; sum = x + y; difference = x - y; product = x * y; quotient = x / y; cout << "The sum of " << x << " & " << y << " is " << sum << "." << endl; cout << "The difference of " << x << " & " << "y << is " << difference << "." << endl; cout << "The product of " << x << " & " << y << " is " << product << "." << endl; cout << "The quotient of " << x << " & " << y << " is " << quotient << "." << endl; getch(); }