// bodies.cpp

void update(std::vector<Body>& bodies, double dT) {
    // Define vectors to hold acceleration and velocity/position updates for each body.
    // .......
    // Write a loop for computing total acceleration of each body.
    // This involves the distance r between the bodies, which you can compute 
    // separately as sqrt(squareDistance(Body,Body);
    //..............
    // Maybe an output here to make sure you're getting what you want:
    /*for (int i = 0; i < bodies.size(); ++i) {
        cout << "acc[" << i << "]=(" << accelerations[i].x << ", " 
             << accelerations[i].y << ")\n";
    }
    cin.get();*/
	// Compute changes in velocity as acceleration * dT
    // .............
    // Use the changes is velocity to update the velocities
    // ...........
    // Compute changes in position Vector2ds 
    // Use the changes in position to update the positions
}

int main() {
    //create bodies
    Body Earth("Earth", {0, 0}, {0,0}, 5.972e24);
    Body Moon("Moon", { 3.85e7, 0}, {0,1023.056 }, 7.35e22); 
    std::vector<Body> bodies{ Earth,Moon };
    //set time increment
    double deltaT = 1e-5;
    //update positions
    int i{ 0 };
    while (1) {
        update(bodies, deltaT);
        if (++i % 200000 == 0) {
            cout << "dist = " << sqrt(squareDistance(bodies[0], bodies[1])) 
                 << endl;
            for (int i = 0; i < bodies.size(); ++i) 
                printBods(bodies[i]);
        }
        if(i%800000==0) 
            cin.get();
    }
}