Update task51.cpp

Removed unnecessary method.