Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed

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 continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

=+1 What would you do if you were the IHR manager?

Answered: 1 week ago