90 137
Assignments Done
99.4%
Successfully Done
In September 2020

Question #11681
Write a program that defines the named constant PI, const double PI = 3.1419; which stores the value of p. The program should use PI and some of the math functions you learn previously to accomplish the tasks. In the main program, prompt the user to input the value of a double variable r, which stores the radius of a circle. The program then call the following functions and output the appropriate results.
(a) The value of &pi;r2, which is the area of the circle.
(b) The value of 2&pi;r which is the circumference of the circle.
1
2012-07-12T08:26:14-0400
# include<iostream.h>
# include<conio.h>

double pi = 3.1419, r;

double area(double r){
return pi*r*r;
}

double circumference(double r){
return 2*pi*r;
}

void main(){
cout<<"Enter the radius of a circle: ";
cin>>r;
cout<<"The area of a circle is "<<area(r)<<"\r\n";
cout<<"The circumference of a circle is "<<circumference(r)<<"\r\n";
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!