simple function question

I have a question in regards to the function declaration. Would I declare another main to express the function or could I just write out the function? And should I delete "meet"?

/*
Program: repair2a: this program prompts for the the velocities (v0, v1) of two approaching
vehicles and their distance (d) apart,
then displays the time they meet and the distance each travels.
Example:
If d is 100, v0 is 75, and v1 is 25,
time is 1.00, distance0 is 75.000, distance1 is 25.00
If d is 151.5, v0 is 65.2, v1 is 42.8,
time is 1.403, distance0 is 91.141, distance1 is 60.039
Add the missing first line of the function and add the function declaration
DO NOT make any other changes
DO NOT us unnecessary refernce parameters
*/

#include <iostream>
#include <iomanip>
using namespace std;

//Function Declaration goes here


int main(void)
{
double d, v0, v1, time, distance0, distance1;

cout << "Enter d, v0, v1: ";
cin >> d >> v0 >> v1;

meet(d, v0, v1, time, distance0, distance1);

cout << fixed << setprecision(3);
cout << "Time is " << time << " distance0 is " << distance0
<< " distance1 is " << distance1 << endl;

return 0;
}


// First line of the function goes here
{
time = d / (v0 + v1);
dist0 = v0 * time;
dist1 = v1 * time;
}
Its just asking you to add the function prototype where it says //Function Declaration goes here and the first line of the function where it says // First line of the function goes here You will not delete meet, that is the point in the program that calls the function. It's also telling you the name that they want the function to be. They just want you to finish the program which needs 2 more lines.
Topic archived. No new replies allowed.