用C++计算圆的周长和面积

 1 #include <stdio.h>
 2 void main()
 3 {
 4     float r;
 5     double cir,area;
 6     const double pi=3.1415926;
 7     printf ("please enter a numbers as radius:");
 8     scanf ("%f",&r);
 9     cir=2.0*pi*r;
10     area=pi*r*r;
11     printf ("the circumference is: %f\n",cir);
12     printf ("the area is: %f\n",area);
13 }

 

posted on 2008-03-24 09:23  Jacky Yu  阅读(2352)  评论(0编辑  收藏  举报