C++: A modification for combining declaration and definition of sqaure function before main