We have an array of Rectangles called rectangleArray and a function updateRectangle(rect) that takes a single rectangle as a parameter and changes its color to a random color. How can we easily change the color of every rectangle inside rectangleArray?

Respuesta :

Limosa

Answer:

Following are the code  

for(var k = 0; k< rectangleArray.length; k++) // iterting the loop

{

updateRectangle(rectangleArray[k]); // update the rectangle color

}  

Explanation:

  • In the given answer we have iterate over the loop will iterated until the length of rectangle array size-1
  • In every value of k, we have called the update rectangle function which changes the color of the rectangle of a rectangle class

In this exercise we have to use the knowledge of computational language in C ++ to write the code.

This code can be found in the attached image.

How can we described this code?

#include<iostream>

#include<stdio.h>

for(var k = 0; k< rectangleArray.length; k++)

updateRectangle(rectangleArray[k]);

}  

See more about C code at  brainly.com/question/19705654

Ver imagen lhmarianateixeira