<iostream.h> is not standard, use <iostream> and <cstring>.
Avoid using c-strings, they are error prone and hard to use. Use std::string instead. http://www.cplusplus.com/reference/string/string/
Using strings, the whole procedure boils down to one function call :