1 // File: area2.cpp
2 // Description: Compute the area of some circles with radius
3 // input by the user.
4 // Author:
5 // Created: 07 Sep 05
6
7 #include <iostream>
8
9 using namespace std;
10
11 intmain()
12 {
13 const double pi = 3.1415926535897932384626433832795;
14 double r;
15 double a;
16
17 cout << "\nThis program will calcuate the area of a circle" << endl;
18 cout << "\nEnter a value for the radius of a circle: ";
19 cin >> r;
20
21 a = pi * r * r;
22
23 cout.precision(3);
24 cout.setf(ios::fixed);
25 cout.setf(ios::showpoint);
26
27 cout << "A circle of radius " << r << " has area " << a << endl;
28
29 return 0;
30 }
31
32