Update Main.cpp

Use of naked pointers is highly risky, C++11 provides smart pointers for automatic memory handling. Using shared pointers guarantees automatic freeing of the memory allocated, even if  exception occurs at critical stage of the program.