Starting from:

$10

Program that creates three vector Solution

Write a program that creates three vector<float objects. Fill the first two objects with 25 floating-point numbers using a for loop as follows:

1. fill the first vector object with the loop counter value;

2. fill the second vector object with the loop counter value squared;

3. finally, write a for loop that adds the corresponding elements in the first two vectors, and puts the result in the corresponding element of the third vector.

Display all three vectors using the format “for counter; element + element = element”.

More products