| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with calculate area of a circle and volume of sphere that are of the same radius
need help on this homework assignment.
help with calculating area of a circle and volume of sphere that are of the same radius. Solution must use functions. I can only work with the areas that are highlighted in bold. #include <iostream> #include <cmath> using namespace std; const double PI = 3.14159; double area (double radius); // function prototype double volume (double radius); void display (double radius, double areaValue, double volumeValue); int main () { double radius; double area_of_circle; double volume_of_sphere; cout<<"Enter the radius"; cin >> radius; area_of_circle = Write the function call ; volume_of_sphere = Write the function call; cout<< "Circle One \n"; display ( write parameters to pass to display); cout << "\n\n"; cout<<"Enter the radius"; cin >> radius; area_of_circle = Write the function call; volume_of_sphere = Write the function call; cout<< "Circle two \n"; display (write parameters to pass to display); system ("PAUSE"); return 0; } /* Computes area of circle */ /* */ /* Inputs: */ /* radius */ /* */ /* Output: */ /* area */ double area (double radius) { return (PI * pow (radius, 2)); } /* Computes volume of sphere */ /* */ /* Inputs: */ /* radius */ /* */ /* Output: */ /* Volume */ double volume (double radius) { return ((4.0/3.0) * PI * pow (radius, 3)); } /* Display computations */ /* */ /* Inputs: */ /* radius, area, volume */ /* */ /* Output: */ /* none */ void display (double radius, double areaValue, double volumeValue) { cout << "Radius = " << radius << " inches \n"; cout << print ("radius"); cout << print ("volume"); } |
|
#2
|
|||
|
|||
|
We all know you put absolutely no effort in this "assignment" when you are stuck on how to print a cout statement to prompt the user for the radius.
|
|
#3
|
|||
|
|||
|
Quote:
It's not that I don't put no effort is that I am not really that good in C++. I have understand some other areas in this program but don't know nothing for this one. I took a course a long time ago but I forgot to work with this. Now I need to understand this better cause basically all my upper levels classes will cover these areas & I need to know the basic concepts for these programs in C++ |
|
#4
|
|||
|
|||
|
darken4life or anyone
If someone can explain this exercise to me step by step, I would gladly appreciated. |
|
#5
|
|||
|
|||
|
This is the sort of thing found in early tutorials on C++.
Sorry, there's little excuse for this one - go look up how to call a function. |
|
#6
|
|||
|
|||
|
Quote:
where can I look it up? I don't want someone to do the exercise for me, what I want is to learn how to do this exercise correctly. I have very little knowledge in C++ . I have learned how to do the grade exercise & some calculations but no like this one. If someone can point me to the right direction on were to learn this I might be able to work on this assignment for a bit. |
|
#7
|
|||
|
|||
|
You can easily google anything up.
http://www.cplusplus.com/doc/tutorial/ |
|
#8
|
|||
|
|||
|
Amen Brutha,
Why don't you read more and figure this out for yourself. You will feel a sense of pride. 2 cents Goto google and type: c++ tutorial || help with c++ |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Help with calculate area of a circle and volume of sphere that are of the same radius |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|