Can anyone help me get started?

This is my assignment -

The volume of a cone is given by the formula:
V = N r2 h / 3

For the value of N use:
const double PI = 3.14159265358979323846;

Declare a structure named: Cone
containing:

height a double, the height of the cone
radius a double, the radius of the base of the cone

Create the following functions:

main

* Contains three variables:
o A pointer named ptr which points to a Cone structure
o A double named height
o A double named radius
* Uses new to obtain space for the data structure
* Calls the the input, setUp, and output functions
* Deletes the space that was obtained using new

input:

* Takes the height of the cone and radius of the base as reference
parameters
* Reads the height and radius from the user
* Has a return type of void

setUp:

* Takes three parameters by value: height, radius, and a pointer to
the Cone
* Puts the data into the data structure
* Has a return type of void

getVolume:

* Takes one parameter by value: a pointer to the Cone
* Computes the volume
* Returns the volume

output:

* Takes one parameter by value: a pointer to the Cone
* Calls the getVolume function to get the volume
* Prints the height, radius, and volume in a neat format
* Has a return type of void

Put the main function first.
Use the function and variable names specified above.
Arrange the functions in the order listed above.

Test your program with the following data:

height 6
radius 2

It would be much appreciated, thank you!
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
The assignment goes into a lot of detail about what functions to create, what arguments those functions should take, what they should do, and what they should return. Surely you can start by implementing some of those functions?
closed account (48T7M4Gy)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// This is my assignment -

// The volume of a cone is given by the formula:
// V = N r2 h / 3

For the value of N use:
const double PI = 3.14159265358979323846;

Declare a structure named: Cone
containing:

height a double, the height of the cone
radius a double, the radius of the base of the cone

Create the following functions:

int main(){

* Contains three variables:
o A pointer named ptr which points to a Cone structure
o A double named height
o A double named radius
* Uses new to obtain space for the data structure
* Calls the the input, setUp, and output functions
* Deletes the space that was obtained using new
return 0;
}

void input(:

* Takes the height of the cone and radius of the base as reference
parameters
* Reads the height and radius from the user)
{

//* Has a 
return type of void
}

void setUp(:

* Takes three parameters by value: height, radius, and a pointer to
the Cone)
{
* Puts the data into the data structure
* Has a 
return type of void
}

int getVolume(:

* Takes one parameter by value: a pointer to the Cone
* Computes the volume
* Returns the volume

output:

* Takes one parameter by value: a pointer to the Cone
* Calls the getVolume function to get the volume
* Prints the height, radius, and volume in a neat format
* Has a 
return type of void;
}

Put the main function first.
Use the function and variable names specified above.
Arrange the functions in the order listed above.

Test your program with the following data:

height 6
radius 2

It would be much appreciated, thank you! 
Last edited on
Read above. That was excellent answer
Topic archived. No new replies allowed.