Using functions in a switch statement

closed account (2zyqM4Gy)
I How can I fix my switch statement?
Last edited on
Well you're missing break statements for each of your cases.

Also, next time post using code tags.
closed account (2zyqM4Gy)
I have break statements within my switch cases.
Given that you have eight functions and four case statements you'll need to be more specific.

Also, be more specific about why it isn't working.
Oh sorry, you do. Was hard to read. What exactly is your issue?
What problem are you having?

When I compile your program, I get the following linker errors:

1>main.obj : error LNK2019: unresolved external symbol "double __cdecl surfaceAreaCylinder(double)" (?surfaceAreaCylinder@@YANN@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "double __cdecl volumeCylinder(double)" (?volumeCylinder@@YANN@Z) referenced in function _main

This indicates that your function protypes do not match your implementation.

You declare surfaceAreaCylinder as follows:
double surfaceAreaCylinder (double nSurfaceAreaCylinder);
But the implementation is:
 
double surfaceAreaCylinder (double radius, double height)


Likewise, you declare volumeCylinder as:
1
2
 
double volumeCylinder (double nVolumeCylinder);

While the implementation is:
1
2
 
double volumeCylinder (double height, double radius)

Your prototypes and implementations must match exactly.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.


Topic archived. No new replies allowed.