![]() |
![]() |
![]() |
![]() |
![]() |
|
Next, the original program contains a for statement that does
reading and writing:
for (limit = 0; cin >> radius >> length; ++limit) {
oil_tanks[limit].radius = radius;
oil_tanks[limit].length = length;
}
You need to add a statement that allocates new space for a
cylinder object and deposits the address of the newly
allocated space into the appropriate array location:
oil_tank_pointers[limit] = new cylinder;
Also, you need to modify existing statements to dereference cylinder pointers:
oil_tank_pointers[limit] -> radius = radius; oil_tank_pointers[limit] -> length = length;
The class-pointer operators appear in the assignment statements, because
you are working with an array of cylinder pointers, rather than
of cylinder objects.