Help on a coordinate plane

Hey can anyone explain to me on how to contrusct this and make it complie? i was looking through my c++ book but im still new too this and i was confused on this assignment. here are the guidelines for the question. any help would be greatly appreciated.

For this assignment you will write a program that asks the user for information about the initial (x,y) position, and (x,y) velocity of an object. Given this information, the program will then print out the (x,y) position of the object at 0, 1, 2, 3, and 4 seconds. You will use the following equation to compute the position over time:

x_pos = x_init + (x_vel * t) + 0.5 * (X_ACC * t * t)


where:

"x_init" is the initial x position,
"x_vel" is the initial velocity in the x direction,
"X_ACC" is the acceleration in the x direction (and a constant in this case),
"t" is the time in seconds, and
"x_pos" is the x position after "t" seconds.
A similar equation would be used to compute the y position over time:

y_pos = y_init + (y_vel * t) + 0.5 * (Y_ACC * t * t)

You can assume that the object is under freefall in earth's atmosphere, so acceleration in the y direction is a constant -9.81, and acceleration in the x direction is a constant 0 (zero). In your program these accelerations should be declared as constant doubles, and "t" should be a variable int.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main(){
    const double X_ACC = 0;
    const double Y_ACC = -9.81;
    double x_init, y_init, x_vel, y_vel;
    std::cout << "Enter initial x: ";
    std::cin >> x_init;
    //And so on...

    double t;
    double x_pos;
    t = 1;
    x_pos = x_init + (x_vel * t) + 0.5 * (X_ACC * t * t);
    //Now we calculated x_pos for t = 1.
}
Topic archived. No new replies allowed.