例
1-1 方法一 , 用结构化方法编程,求圆的周长和面
积
// count the girth and area of circle
#include<iostream>
using namespace std ;
int main ()
{ double r, girth, area ;
const double PI = 3.1415 ;
cout << "Please input radius:\n" ;
cin >> r ;
girth = 2 * PI * r ;
area = PI * r * r ;
cout << "radius = " << r << endl ;
cout << "girth = " << girth << endl ;
cout << "area = " << area << endl ;
}