这个程序在编译时没有错误,但在运行时有错误,求指点

#include<stdio.h>
#include<math.h>
int main()
{float a,b,c,l,s;
scanf("%f,%f,%f",&a,&b,&c);
l=(a+b+c)/2;
s=l*(l-a)*(l-b)*(l-c);
s=sprt(s);
printf("%f",s);
return 0;
}

修改了一下,如下:
#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,l,s;
scanf("%f,%f,%f",&a,&b,&c); //中文分号
l=(a+b+c)/2;
s=l*(l-a)*(l-b)*(l-c);
s=sqrt(s); //中文分号,而且调用函数应该是sqrt(),不是sprt
printf("%f",s);
return 0;
}

其他没问题呃~~不过有中文分号应该过不了编译啊..~怎么过的编译呃……反正改过后运行就正常了
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-10-01
你关闭工作空间 重新打开在试;还有我感觉你给的程序好像有中文状态的符号啊。
第2个回答  2012-10-01
是sqrt不是sprt
相似回答