By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

M:\lineX\lineX.cpp(38) : error C2447: missing function header (old-style formal list?

P: 1
//----------------------------------------------------------------
//This program will find the length of a line on a plane. With the
//one end at the origin and the other end selected by the user and
//print it to screen.

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

int main()
{

//Define constants, variables, and prototypes.
double length(double x, double y);
double x_in,y_in;


//Have user enter values for x and y.
cout << " Enter in the values for x and y. " <<endl;
cout << " Enter x value." <<endl;
cin >> x_in;
cout << " Enter y value." <<endl;
cin >> y_in;

//Print anwser to screen.
cout << "The length of the line is equal to " << length <<"."<<endl;

//Exit program.
return 0;

}

//-----------------------------------------------------------------
//This function evaluates the length of the line.
//
double length(double x, double y);
*{


sqrt(pow(x_in,2)+pow(y-in,2));
return length;
}

//-----------------------------------------------------------------

The astric is where the program has the error. What is wrong?
Sep 27 '06 #1
Share this Question
Share on Google+
1 Reply


100+
P: 293
D_C
Expand|Select|Wrap|Line Numbers
  1. double length(double x, double y);
  2. *{
should be
Expand|Select|Wrap|Line Numbers
  1. double length(double x, double y)
  2. {
Also
Expand|Select|Wrap|Line Numbers
  1.   cout << "The length of the line is equal to " << length <<"."<<endl;
should be
Expand|Select|Wrap|Line Numbers
  1.   cout << "The length of the line is equal to " << length(x_in,y_in) <<"."<<endl;
Sep 27 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.