(Diameter, Circumference and Area of a Circle) Write a program that reads in the radius of a circle as an integer and prints the circle’s diameter, circumference and area. Use the constant value 3.14159 for ?. Do all calculations in output statements. [Note: In this chapter, we have discussed only integer constants and variables. In Chapter 3 we discuss floating-point numbers, i.e., values that can have decimal points.]
What will be an ideal response?
```
(Diameter, Circumference and Area of a Circle) Write a program that reads in the radius of
a circle as an integer and prints the circle’s diameter, circumference and area. Use the constant value
3.14159 for ?. Do all calculations in output statements. [Note: In this chapter, we have discussed
only integer constants and variables. In Chapter 3 we discuss floating-point numbers, i.e., values
that can have decimal points.]
cout << "Diameter is " << radius * 2.0
<< "\nCircumference is " << 2 * 3.14159 * radius
<< "\nArea is " << 3.14159 * radius * radius << endl;
} // end main
```
You might also like to view...
The ____________________ DTD is used for documents containing frames.
Fill in the blank(s) with the appropriate word(s).
Access does not require a field description for every field included in a table. _________________________
Answer the following statement true (T) or false (F)
The term public cloud refers to the services and applications that are owned by the public.
Answer the following statement true (T) or false (F)
You’re probably wearing on your wrist one of the world’s most common types of objects— a watch. Discuss how each of the following terms and concepts applies to the notion of a watch: object, attributes, behaviors, class, inheritance (consider, for example, an alarm clock), modeling, messages, encapsulation, interface and information hiding.
What will be an ideal response?