I made a program to find the surface area or volume of a sphere and it works, but my teacher says its not object oriented and does not use classes. Can someone help me because i dont know how to do it.
If you define these functions (should be easy using your pre-existing code), then in main, ask for a radius, construct a sphere with that radius and then use its member functions to return things like volume and surface area. If you're confused about how to do this, there are some very good tutorials on OOP in the tutorials section of this site.
Okay. Outside of main, put the code I gave, which is the code for a class called sphere that contains a radius and has functions get_radius(), get_volume() and get_surface_area();
After the class declaration, define each of these functions as follows: