fixing a messed up program

so my professor sent us a program with a bunch of mistakes that we have to fix and explain why.
i understand most of it, but this part tripped me up

//////////////
double calcArea(double, double);
double calcPerimeter(double, double);
double calcVolume(double, double, double);
double calcSurfaceArea(double, double, double);

int main(); {
integer length;
string width;
double height, double area, double surfaceArea;
double perimeter;
/////////////////////////

que 1 why would we declare calPerimeter as a variable but then also declare it again with just double perimeter?

que 2: is there a specific reason why it says (double, double) in the first part? or is that my professors way of writing a bad code? is it safe to just go ahead and delete iT ?

also can i replace integer length and string width with just double length and double width?

i'm honestly not quite sure what my question is 100% but hopefully that made sense..
thanks!
Last edited on
que 1 why would we declare calPerimeter as a variable but then also declare it again with just double perimeter?
calcPerimeter is a function which calculates perimeter when given sides. perimeter is a variable (presumably to store result of caclPerimeter).

que 2: is there a specific reason why it says (double, double) in the first part? or is that my professors way of writing a bad code? is it safe to just go ahead and delete iT ?
Maybe it is because that function should take two arguments?
http://www.cplusplus.com/doc/tutorial/functions/

also can i replace integer length and string width with just double length and double width?
If you need to fix mistakes, this does look as mistake, so go ahead and fix it.

Look also at the line 3 in main(). There is problem here too.
Last edited on
Topic archived. No new replies allowed.