Need help with a homework assignment

Very new to this subject. I some what understand but most of my homework or questions normally isn't covered in my class lectures. Can some one explain to me like a step by step.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Constants, variables and arithmetic operators
//
// This program will output the circumference and area
// of the circle with a given radius.


#include <iostream>

using namespace std;

const  double PI = 3.14;
const  double RADIUS = 5.4;

int main()
{
	?????? area;			            // definition of area of circle
    double circumference;		        // definition of circumference

    circumference = 2 * PI * RADIUS;	// computes circumference

    area = ?????;                // computes area


   // Fill in the code for the cout statement that will output (with description)
   // the radius
   ?????????

   // Fill in the code for the cout statement that will output (with description)
   // the circumference
   ?????????

   // Fill in the code for the cout statement that will output (with description)
   // the area of the circle
   ?????????


   return 0;
}
/*********************************************************************************
SAVE THE OUTPUT HERE
*/
closed account (3qX21hU5)
1) On line 17 You need to define a type for the variable "area". What type would work best for this?

2) On line 22 You need to assign something to your "area" variable. How would you find the area? Once you figure that out store the result of that in the variable "area".

3) On line 27 You need to print to the console what the radius is. (Hint: to print to the console you can use cout)

4) On line 31 You need to print out the circumference. This is just like #3 the only thing different is we are printing out a different variable.

5) On line 35 You need to print out the area of the circle. This should know how to do by now.

6) You are done :)
Topic archived. No new replies allowed.