平方根函数 立方根函数 #include <stdio.h> #include <math.h> int main() { double x, r; scanf("%lf", &x); if(x >= 0) r = sqrt(x); else r = pow(x + 1, 2) + 2 * x + 1 / x; printf("f(%.2lf) = %.2lf", x, r); return 0; }