Given the following code. float dollars[5] = {1986.10, 240.99, 215.50, 75.00, float euros[5]; Give the C++ code that will fill the euros array with the corresponding euro value dollars array. So the first element of euros will be equivalent to the euro vat clement of the dollars array, etc. Use the following formula: 1 dollar = .92 euro

Respuesta :

Answer:

#include <iostream>

using namespace std;

int main()

{

  float dollars[5] = {1986.10, 240.99, 215.50, 75.00, 65.97};

  float euros[5];

  for(int i=0;i<5;i++){

      euros[i] = dollars[i]*0.92;

  }

  for(int i=0;i<5;i++){

      cout<<euros[i]<<endl;

  }

  return 0;

}

Explanation:

First include the library iostream for input/output.

then, create the main function and declare the arrays.

after that, take a for loop for traversing through dollars array and convert into euros by multiply each element with 0.92 value and store in the euros array with same index value as dollars array.

finally, take the for loop for print each element of the euros array.