Calling Functions

Posted on 2000-04-19
Last Modified: 2010-04-02
What is the right way to call a function in a program?
Question by:SBuntin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 22

Accepted Solution

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

example follows.
LVL 22

Expert Comment

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

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

// 2 parameters.
int Add(int x,int y)
   return x + y;

     *    *    *

int x = GetZero();
int y = Increment(x);
int z = Add(x,y);

Let me know if you have any questions.

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>

void DegreesToRadians();
void RadiansToDegrees();

int main()
      int convert;
      int degree, radian;

      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
            cout << "Radians? ";
            cin >> radian;

            // Calculations and Output


return 0;

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

  return totalb;

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

      return totalB;
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

float DegreesToRadians(float);
float RadiansToDegrees(float);

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question