error in code - c++ beginner, have searched forum and the internet for hours now

Hello,

I'm sure this is probably a simple fix, but I have been searching for hours for a solution to no avail. I'm very new at c++ so any help here would be appreciated. My assignment is to create a program that will determine the duration of flight for a projectile and its height above the ground as it reaches a target. here is what I have so far:

// THIS PROGRAM IS INTENDED TO CALCULATE THE DURATION AND HEIGHT ABOVE GROUND OF A PROJECTILE IN FLIGHT
// AS IT REACHES ITS TARGET. CALCULATIONS ARE BASED ON: A GRAVITATIONAL CONSTANT OF G = 32.17, THE ANGLE OF THE
// PROJECTILE'S ELEVATION AT LAUNCH, THE PROJECTILE'S VELOCITY, THE DISTANCE TRAVELLED TO THE TARGED,
// AND WILL USE THE DOUBLE DATA TYPE FOR MORE PRECISION. TWO DATA SETS WILL BE SUBMITTED TO ENSURE ACCURACY.

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

using namespace std;

const double g = 32.17; //GRAVITATIONAL CONSTANT

void instructions();
double calTime(double, double, double);
double calHeight(double, double, double);

int main ()
{

double distance; //THE DISTANCE TO TARGET.
double velocity; //THE VELOCITY OF PROJECTILE.
double theta; //THE ANGLE OF ELEVATION AT LAUNCH.
double calHeight; //THE HEIGHT OF PROJECTILE ABOVE GROUND AT TARGET.
double calTime; //THE TIME OF FLIGHT.

//THIS FUNCTION DISPLAYS THE INFORMATION ABOUT WHAT THIS PROGRAM DOES
//AND TAKES INPUT FROM THE USER IN A SPECIFIC FORM.
instructions();
cout << "What is the angle of elevation in radians?" <<endl;
cin >> theta;
cout << "What is the velocity in ft/sec? " <<endl;
cin >> velocity;
cout << "What is the distance to target in feet?" <<endl;
cin >> distance;

calTime = distance/(velocity*cos(theta));
calHeight = velocity*sin(theta)*calTime-((g*calTime*calTime)/2);

cout << "The projectile was" << calHeight << "feet above ground and"
<< "was in the air for" << calTime << "seconds." <<endl;

return 0;
}
//THIS FUNCTION TELLS THE USER WHAT TO DO. THERE ARE NO INPUTS OR OUTPUTS.
void instrucitons()
{
cout << "To obtain the results for time and height you must input distance, velocity, and angle." <<endl;
}
//THIS FUNCTION TAKES DISTANCE, VELOCITY, AND THEN ANGLE AS INPUTS
//AND CALCULATES THE TIME THE PROJECTILE WAS AIRBORN.
double calTime(double, double, double);
{
double distance;
double velocity;
double theta;
double calTime;

calTime=distance/(velocity*cos(theta));
return calTime;
}
//THIS FUNCTION TAKES, VELOCITY, THE ANGLE, AND TIME (FOUND WITH THE PREVIOUS FUNCTION)
//AND CALCULATES THE HEIGHT OF THE PROJECTILE WHEN IT MEETS THE TARGET.
double calHeight(double, double, double);
{
double velocity;
double theta;
double calTime;
double calHeight;

calHeight=velocity*sin(theta)*calTime-((g*calTime*calTime)/2);
return calHeight;
}

---------------------------------------------------------------------

I'm getting 2 errors, both C2447: '{' : missing function header (old-style formal list?), at lines 52 and 64. Thanks to anyone that can help!
double calTime(double, double, double); <-out of place semicolon here

Also note that if you don't name the parameters, you'll have no way of using them in the function.
Thank you.

by name them, do you mean saying something like double calTime(double distance, double velocity, double theta)?
I removed the two out of place semicolons and now I'm getting 6 error C2082's at the lines that say

{
double distance;
double velocity;
double theta;

and

{
double velocity;
double theta;
double calTime;
Could it be that you redeclared vars?
so i took those lines out and now i get 2 errors,

error LNK2019: unresolved external symbol

and

fatal error LNK1120 1 unresolved externals
is the code just out of order or do i have an incomplete function somewhere? here is what i have now:

// THIS PROGRAM IS INTENDED TO CALCULATE THE DURATION AND HEIGHT ABOVE GROUND OF A PROJECTILE IN FLIGHT
// AS IT REACHES ITS TARGET. CALCULATIONS ARE BASED ON: A GRAVITATIONAL CONSTANT OF G = 32.17, THE ANGLE OF THE
// PROJECTILE'S ELEVATION AT LAUNCH, THE PROJECTILE'S VELOCITY, THE DISTANCE TRAVELLED TO THE TARGET,
// AND WILL USE THE DOUBLE DATA TYPE FOR MORE PRECISION. TWO DATA SETS WILL BE SUBMITTED TO ENSURE ACCURACY.

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

using namespace std;

const double g = 32.17; //GRAVITATIONAL CONSTANT

void instructions();
double calTime(double, double, double);
double calHeight(double, double, double);

int main ()
{

double distance; //THE DISTANCE TO TARGET.
double velocity; //THE VELOCITY OF PROJECTILE.
double theta; //THE ANGLE OF ELEVATION AT LAUNCH.
double calHeight; //THE HEIGHT OF PROJECTILE ABOVE GROUND AT TARGET.
double calTime; //THE TIME OF FLIGHT.

//THIS FUNCTION DISPLAYS THE INFORMATION ABOUT WHAT THIS PROGRAM DOES
//AND TAKES INPUT FROM THE USER IN A SPECIFIC FORM.
instructions();
cout << "What is the angle of elevation in radians?" <<endl;
cin >> theta;
cout << "What is the velocity in ft/sec? " <<endl;
cin >> velocity;
cout << "What is the distance to target in feet?" <<endl;
cin >> distance;

calTime = distance/(velocity*cos(theta));
calHeight = velocity*sin(theta)*calTime-((g*calTime*calTime)/2);

cout << "The projectile was" << calHeight << "feet above ground and"
<< "was in the air for" << calTime << "seconds." <<endl;

return 0;
}
//THIS FUNCTION TELLS THE USER WHAT TO DO. THERE ARE NO INPUTS OR OUTPUTS.
void instrucitons()
{
cout << "To obtain the results for time and height you must input distance, velocity, and angle." <<endl;
}
//THIS FUNCTION TAKES DISTANCE, VELOCITY, AND THEN ANGLE AS INPUTS
//AND CALCULATES THE TIME THE PROJECTILE WAS AIRBORN.
double calTime(double distance, double velocity, double theta)
{
double calTime;
calTime=distance/(velocity*cos(theta));
return calTime;
}
//THIS FUNCTION TAKES, VELOCITY, THE ANGLE, AND TIME (FOUND WITH THE PREVIOUS FUNCTION)
//AND CALCULATES THE HEIGHT OF THE PROJECTILE WHEN IT MEETS THE TARGET.
double calHeight(double velocity, double theta, double calTime)
{
double calHeight;
calHeight=velocity*sin(theta)*calTime-((g*calTime*calTime)/2);
return calHeight;
}
Topic archived. No new replies allowed.