Update cal.cpp

added a square method