1. Use getline is very nice.
2. You are not allocating memory for b your setting it to a so your delete is not really doing anything. What you are doing is not what delete is meant for, it is meant for things like this
std::getline(cin,myString); //saying get input from cin and save it in string
ptr = new int; //allocating memory for ptr
*ptr = 10; //setting the value of ptr to 10