Well there is a fair amount of issues I see here. So I will start off with any time your say double& when you actually mean
1 2 3 4 5 6 7 8 9 10 11
|
void someFunction (double& something) {
something = 1;
}
int main () {
double something;
someFunction (something);
cout << something;
return 0;
}
|
and the output if I remember this stuff correctly should be 1;
This being said passing a reference when it is a double or a int is pretty much pointless as passing copies takes up just as much time/memory as pointers to int and so forth.
The second thing is if you write a function don't keep rewritting it like at line 31, 48. You rewrote a function that already exists all you had to do was write a function prototype above input shape. Like so...
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <libraries>
using namespace std;
void inputDimension (double something, double otherthing)
// then in your inputshape function
if ( shape == SPHERE)
{
void inputDimension (double something, double otherThing); // this is all you need to use this function.
}
|
Also, don't change number of function arguments if inputDimension calls for two arguments then input two arguments. Otherwise, you have a different function or you can pass a hard coded argument and then ignore it. I point this out because you do so in line 19 where is should be similar to line 31 or write a different function with a different name that only uses one function argument. Yes, that statement is also direction at your two different performComputation functions...
Furthermore, I don't understand why you are using 1 as a char just keep as an int your making it harder on yourself.
Also, there are some problems in your main, for example:
Quite simply this is error. Perhaps you might to have
1 2 3
|
char returnedStatement = inputShape()
|
However, you would have to change your type.
This is the same problem with your if statements such as
1 2
|
if ( inputShape() == SPHERE)
|
Your trying to make a comparison between a char and a void function. This also needs to changed.
Now to the question you were probably looking it depends on the point of function all I see is the assignment of some variables that weren't declared in the function.
I hope this helps and I pray this isn't a troll post....