s1 being the name, tetrahedron being the type, 3.2 being the side_length.
My goal is to find the volume for each shape and then use a sorting routine to sort the list by volume in ascending order. Here's my code, what would be the correct way to write my calculateVolume method?
Alright I did as you told but how would I pass the compute_volume into my main method?
Correct me if I am wrong, what you did here was reference the struct Platonic and assigned it p. So that way I would be able to have a pointer to the shapes in calculateVolumes.
int main()
{
enum {NSHAPES = 12};
Platonic shapes[NSHAPES];
// shapes has already been defined above.
// Platonic shapes[12]; // this is a redefinition
// note: you might want to add an extra parameter to readfile()
// using which you can pass the maximum number of objects in the
// array as an argument.
// since the file may contain information about fewer objects
// make readfile() return the actual number of objects read.
readFile(shapes);
calculateVolumes(shapes, NSHAPES);
return 0;
}