Added square check cpp