Author Topic: Demo using circle  (Read 2797 times)

louiecerv

  • Moderator
  • User
  • *****
  • Posts: 85
Demo using circle
« on: November 22, 2005, 12:52:35 AM »
Here's the code for the circle demo we discussed earlier:

Code: [Select]

#include <iostream>

using namespace std;

int main()
{
    const double PI = 3.14159;
    cout << " -- A PROGRAM TO SOLVE AREA & CIRCUMFERENCE --";
    cout << endl << "Enter the radius: ";
    double radius;
    cin >> radius;
    double area, circ;
    area = PI * radius * radius;
    circ = 2 * PI * radius;
    cout.setf(ios::showpoint);
    cout.setf(ios::fixed);
    cout.precision(2);
    cout << "area = " << area << endl;
    cout << "circumference = " << circ << endl;

    system("PAUSE");
    return 0;
}
Analyze. Design. Develop. Debug. Deploy. Maintain.