logo

Crowdly

   1. Create a structure Car with the following elements       - two array poi...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

   1. Create a structure Car with the following elements

      - two array pointers, one for position x and one for position y.

      - one variable to store the car id.

      - one variable to store the number of movement steps of the car.

   2. Create an array of structures of type Car for 5 cars.

      For each car, reserve memory to store 1000 positions using the operator new.

   3. Set the position of the car with the following formula       

       car_position_x_now = car_position_x_previous + (car_id+1)*0.5

       car_position_y_now = car_position_y_previous - (car_id+1)*0.5       

   4. Print the last position of each car and free the positions' arrays

      from memory using the operator delete.

   Use the following code as an example:

More questions like this

Want instant access to all verified answers on upel.agh.edu.pl?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!