{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# circles2 - endl cout<<"What is the circle's...

This preview shows page 1. Sign up to view the full content.

// Demo program for computing area and circumference of a circle // Modified to show use of the pow function of math.h #include <iostream.h> // for cin, cout #include <math.h> // for pow const double PI = 3.1415926; // ratio of circum to diam of a circle int main() { double radius; // radius of a circle, any linear units double area; // area of same circle, square units double circum; // circumference of same circle, same linear units cout << "This program computes the area and circumference of a circle." <<
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: endl; cout << "What is the circle's radius? "; // prompt for radius cin >> radius; area = PI*pow(radius, 2); // compute area using PI*r^2 circum = 2*PI*radius; // compute circumference using 2*PI*r cout << "Area:\t\t" << area << endl; // output results cout << "Circumference:\t" << circum << endl; cout << "(Circumference in same units as input; area in square units.)" << endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern