Question
C++ Write a program to calculate the Area of a circle and display the computed Area, radius and the circles name on the screen (see
C++
Write a program to calculate the Area of a circle and display the computed Area, radius and the circles name on the screen (see Figure ). Name your program AreaOfCircle.cpp.
Your program will have the following four variables:
- radius: of type unsigned int. Initialize the variable to 10.
- PI: is a constant (const) of type double. Initialize the variable to 3.14159.
- area: of type double. This variable will be calculated using the following formula:
area = p * r2
- CIRCLE_NAME: is a constant of type string. Initialize the variable to Mycircle.
Note: The first step in using string is to #include the string header file.
Here is the pseudocode of this program, which you will convert to C++ code.
Store Mycircle in the CIRCLE_NAME constant variable.
Store 3.14159 in the PI constant variable.
Store 10 in the radius variable.
Multiply PI by radius square and store the result in the area variable.
Display the circles name, radius and the content of the area variable. (see Figure for the correct output format)
G. C:\Windows\system32\cmd.exe Circle's Name: MyCircle Circle's Radius: 10 MyCircle with radius 10 has an area equals to 314.16. Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started