I have to create a program that will prompt a user radius and keep adding them until user says no. Then, the program gotta able to hold those numbers and calculate two things: Surface area and Volume. The program also gotta able to Sort the numbers. And the program will also gotta able to do Displaying all the values that users put(Radius, volume and Surface)
- I don't understand why infloat Sphere::variable() wouldn't save the value...(Seems like I can't even display what I put)
-How do I pass the radius value in float Sphere::variable() to float Sphere::area() and float Sphere::volume()??
Inside your switch, case 1 and 3, you are declaring a new Sphere each time. When the switch statement ends your Spheres are losing scope. Although you reference them both by the same name (info) they are different objects.
Inside Sphere::variable() you are not returning a value even though the function declaration says you should be.
Sphere::area() is returning a value, but you are doing nothing with it. (inside case 3).
Apart from the oversight in Sphere::variable(), your class seems pretty sound to me. The only real issue is the implementation inside Main.cpp (IE: the scope of your Sphere info, and not actually telling the program to print info.area() to the screen)
You have Sphere(float); in Sphere.h but you don't have it in Sphere.cpp, and you do not use it nowhere.
vector list exists only in function variable(), but not in class. And you do not do anything with it. So you do not need it.
You do not use this variables to Sph_SA, Sph_Vol so you do not need them.
Variable double Sph_radius should be in private section.
exit(0); you can change to return 0; you will have two return 0;