Update calc.cpp

add new method