x
Solved

# Calling Functions

Posted on 2000-04-19
Medium Priority
223 Views
What is the right way to call a function in a program?
0
Question by:SBuntin
• 3

LVL 22

Accepted Solution

nietod earned 120 total points
ID: 2731978
you use the functin name a left parenthises, then any parameters, then a right parenthesis.

example follows.
0

LVL 22

Expert Comment

ID: 2731985
// no parameters.
int GetZero()
{
return 0;
}

// 1 parameter.
int Increment(int i)
{
return i +1;
};

// 2 parameters.
{
return x + y;
};

*    *    *

int x = GetZero();
int y = Increment(x);

Let me know if you have any questions.
0

Author Comment

ID: 2735885
I am having problems linking or something...I really don't know what it is saying...

Here is my problem whats wrong:

#include <iostream.h>
#include <math.h>

int main()
{
int convert;

cout << "What would you like to convert to?\n";
cout << "1. Degrees to Radians";
cout << "2. Radians to Degrees";
cin >> convert;

if (convert == 1)
{
// Input
cout << "Degrees? ";
cin >> degree;

// Calculations and Output
}

if (convert == 2)
{
// Input

// Calculations and Output

}

return 0;
}

{
float pi = 22 / 7;
float totalb = degree * (pi/180);

}

{
float pi = 22 / 7;
float totalB = radian * (180/pi);

}
0

LVL 22

Expert Comment

ID: 2742552
The forward declarations of the 2 conversion functions do not match the function definitions.  Both the definitions take floats as parrameters and return floats as return values.  but your forward definitions take no parameters and return no values.  You should change them to

0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.