1234567891011
void p2 (int &n, int & x) { x = 0; double powX = 0; while(powX < n) { powX = pow(x, 2) + 2*x + 1; x = x+1; } }