Question: in c++ please, More vector use When outputting a vector, output each element separated byspace ```' '```` then a newline after all elements have beenoutputted.

in c++ please,

More vector use

  • When outputting a vector, output each element separated byspace ```' '```` then a newline after all elements have beenoutputted.
  • Read some floating-point values from doubles.txt intoa vector called vd
  • Output vd to cout.
  • Make a vector vi oftype vector with the same number of elementsas vd and copy the elements from vd into vi.
    • You can either use a range constructor orthe copy function.
  • Output vi to cout
  • Output "Sum of vd: " followed by the sum of the elementsof vd. Use accumulate (#include)
  • Output "diff of sums: " followed by the difference between thesum of the elements of vd and the sum of the elementsof vi.
  • There is a standard library algorithmcalled reverse that takes a sequence (pair of iterators)as arguments; reverse `vd
  • Output vd to cout
  • Output "Mean: " followed by the mean value of the elementsin vd. Use accumulate and .size
  • Make anew vector called vd2 and copyall elements of vd with values lower than (less than) themean into vd2. Use copy_if.
    • Use either a lambda function or a function object to compareeach element to the mean and return a boolean.
  • Sort vd
  • Output vd to cout

/////////////double.txt

12.12
9.9
3.3
15.15
4.4
6.6
2.2
8.8
10.10
11.11
5.5
1.1
13.13
14.14
16.16
7.7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!