#include <iostream> #include <iomanip> using std::cout; using std::endl; int main() { const double pi = 3.14; cout << endl; for(double radius = .2 ; radius <= 3.0 ; radius += .2) cout << "radius = " << std::setw(6) << radius << " area = " << std::setw(12) << pi * radius * radius << endl; return 0; }
radius = 0.2 area = 0.1256 radius = 0.4 area = 0.5024 radius = 0.6 area = 1.1304 radius = 0.8 area = 2.0096 radius = 1 area = 3.14 radius = 1.2 area = 4.5216 radius = 1.4 area = 6.1544 radius = 1.6 area = 8.0384 radius = 1.8 area = 10.1736 radius = 2 area = 12.56 radius = 2.2 area = 15.1976 radius = 2.4 area = 18.0864 radius = 2.6 area = 21.2264 radius = 2.8 area = 24.6176