Using functions in a switch statement

Feb 19, 2013 at 8:38pm
closed account (2zyqM4Gy)
I How can I fix my switch statement?
Last edited on Feb 20, 2013 at 6:22pm
Feb 19, 2013 at 9:25pm
Well you're missing break statements for each of your cases.

Also, next time post using code tags.
Feb 20, 2013 at 1:34am
closed account (2zyqM4Gy)
I have break statements within my switch cases.
Feb 20, 2013 at 1:42am
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.
Feb 20, 2013 at 1:43am
Oh sorry, you do. Was hard to read. What exactly is your issue?
Feb 20, 2013 at 1:52am
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.