So how do I convert these few lines to C++?
char *str = new char[amp.length()+1];
strcpy (strr, amp.c_str());
------------------------------------------
if (pch && pch1)
{
cout << array[index] << endl;
}
These lines are already written in C++, not in C.
amp
is already a std::string, you have used new
operator, etc