logo

Crowdly

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

   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:

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на upel.agh.edu.pl?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!