//Main Program
//cout<<"Enter the same volume for all 3 items: ";
//cin>>Spehere>>Cylinder>>Cone value;
//cout<<" "<<Sphere<<" "<<Cylinder<<" "<<Cone;
cout<<"The Values enter will be the same for a Sphere, Cylinder, and Cone"<<endl;
cout<<endl;
cout<<"Enter the radius value:"<<endl;
cin>>r;
cout<<endl;
cout<<"Enter the height value:"<<endl;
cin>>h;
cout<<endl;
cout<<endl;
cout << "Item Volume Surface Area\n-----------------------------------------------------\n";
From what you've given...
- you can't calculate with values until you've actually input them (c++ is no more capable of time travel than you or I);
- you will suffer from integer division; 4/3 gives 1 and 1/3 gives 0, for example
- you appear to be trying to divide by 3 twice in your formula for volume of a sphere
- there is no calculation for surface area of a cone
- if you create a variable called pi then (a) make it accurate; and (b) use it!
- just use double rather than mixing in float; memory is cheap; accuracy isn't
- use meaningful names for variables rather than b1, b2, b3, ...
So you have the use a user input and it should be able to calculate whatever the volume and surface area for what ever is inputted. When I run it all I get is zeros. I need to know how to get the formulas for the 3 items and be able to use any input number with it.
Read my post, please, uguerro, especially the points about doing things in logical order (input values FIRST, then calculate with them) and the result of integer division.
It also makes threads more readable if you post amendments AFTER, not changing earlier posts.