怎么用Tc编一个 计算圆得面积的程序!!急求!!!

来源:百度知道 编辑:UC知道 时间:2024/05/09 19:06:36
我编的哪里错了,,大虾指点!!!
#include "stdio.h"
#include "math.h"
main()
{
double a,b,c;
printf("please put a number:");
scanf("%f",&a);
b=2*a*3.14;
c=a*a*3.14;
printf("get the number is: %f%f",b,c);
getch();
}

我不知道你最后getch()用来做什么?结果不都已经在前一句打印出来了么.如果要用getch()的话,需要加头文件conio.h.
另外,如果还不可以的话,你可以把double a a, b, c改为 float a, b, c;就可以了.我运行过通过了,你试试看.

把%f都改成%lf
%f对应的是float
%lf是double