#include<stdio.h> #include"math.h" main() { int a,b,c; double x,y,d; scanf("%d%d%d",&a,&b,&c); d=b^2-4*a*c; if(d>=0) { x=(-b+sprt(d))/2*a; y=(-b-sprt(d))/2*a; } else printf("请重新输入!"); printf("%.2f %.2f",x,y); return; } /* Main.c:3:1: warning: return type defaults to 'int' main() ^ Main.c: In function 'main': Main.c:8:7: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses] d=b^2-4*a*c; ^ Main.c:11:3: warning: implicit declaration of function 'sprt' [-Wimplicit-function-declaration] x=(-b+sprt(d))/2*a; ^ Main.c:17:2: warning: 'return' with no value, in function returning non-void return; ^ /tmp/cce5PFX9.o: In function `main': Main.c:(.text+0x7b): undefined reference to `sprt' Main.c:(.text+0xc4): undefined reference to `sprt' collect2: error: ld returned 1 exit status */ |
Double click to view unformatted code.