为什么我用C-free5.0运行下面这个程序怎么老出错,哪错了?
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/10 16:32:37
为什么我用C-free5.0运行下面这个程序怎么老出错,哪错了?
#include
#include
int main()
{
\x09const double pi = 4.0 * atan(1.0);
\x09double r,h,s1,s2,s;
\x09scanf("%lf%lf",&r,&h);
\x09s1 = pi*r*r;
\x09s2 = 2*pi*r*h;
\x09s = s1*2.0 + s2;
\x09printf("Area = %.31f\n",s)
\x09return 0;
}
--------------------配置:mingw5 - CUI Debug,编译器类型:MinGW--------------------
检查文件依赖性...
正在编译 C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp:12:error:expected `;' before "return"
[Warning] C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp:13:2:warning:no newline at end of file
构建中止 未命名1:1 个错误,1 个警告
#include
#include
int main()
{
\x09const double pi = 4.0 * atan(1.0);
\x09double r,h,s1,s2,s;
\x09scanf("%lf%lf",&r,&h);
\x09s1 = pi*r*r;
\x09s2 = 2*pi*r*h;
\x09s = s1*2.0 + s2;
\x09printf("Area = %.31f\n",s)
\x09return 0;
}
--------------------配置:mingw5 - CUI Debug,编译器类型:MinGW--------------------
检查文件依赖性...
正在编译 C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp:12:error:expected `;' before "return"
[Warning] C:\Users\Administrator\Documents\C-Free\Temp\未命名1.cpp:13:2:warning:no newline at end of file
构建中止 未命名1:1 个错误,1 个警告
你好!修改后的代码,代码功能没有验证:
#include<stdio.h>
#include<math.h>
int main()
{
const double pi = 4.0 * atan(1.0);
double r, h, s1, s2, s;
scanf("%lf%lf", &r, &h);
s1 = pi*r*r;
s2 = 2*pi*r*h;
s = s1*2.0 + s2;
printf("Area = %.31f\n", s);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
const double pi = 4.0 * atan(1.0);
double r, h, s1, s2, s;
scanf("%lf%lf", &r, &h);
s1 = pi*r*r;
s2 = 2*pi*r*h;
s = s1*2.0 + s2;
printf("Area = %.31f\n", s);
return 0;
}