|
刚学习C语言,用的是谭浩强的《C程序设计》。书中的程序在RH7.3中可以编译,但是在RH8中却无法编译,不知是为什么?
底下是一个非常简单的求三角形面积的程序l310.c,
#include "math.h"
main()
{
float a,b,c,s,area;
scanf("%f,%f,%f,&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("a=%7.2f,b=%7.2f,c=%7.2f,s=%7.2f\n",a,b,c,s);
printf("area=%7.2f\n",area);
}
编译时提示:
l310.c:5:7: warning: multi-line string literals are deprecated
l310.c: In function `main':
l310.c:5: parse error before "a"
l310.c:5: stray '\' in program
l310.c:8:45: warning: multi-line string literals are deprecated
l310.c:5: stray '\' in program
l310.c:9:21: warning: multi-line string literals are deprecated
l310.c:9:21: missing terminating " character
l310.c:5:7: possible start of unterminated string literal
问题可能很幼稚,请不吝赐教。 |
|