# Question: please help code this in c and follow format the...

###### Question details

please help code this in c++ and follow format, the assignment starts below the dashed line

_____________________________________________________

- Test each step as you go by entering at least three pairs of values. More values would be better.

(1)

- Write a program that consists of a while-loop that reads in one double each time around
- Each time through the loop write out the value entered
- Define two variables to keep track of which is the smallest and which is the largest value you have seen so far
- If it’s the smallest or tied for the smallest so far, write The smallest so far after the number.
- If it is the largest or tied for the largest so far, write The largest so far after the number.
- Exit the program when a terminating '|' is entered.

(2)

- Add a unit to each double entered; that is, enter values such as 10cm, 2.5in, 5ft, or 3.33m.
- Accept the four units: cm, m, in, ft. Assume conversion factors 1m == 100cm, 1in == 2.54cm, 1ft == 12in.
- Read the unit indicator into a string. You may consider 12 m (with a space between the number and the unit) equivalent to 12m (without a space). Keep in mind that cin will read them the same way.
- After converting, each time through the loop write out the value entered in meters

(3)

- Reject values without units or with “illegal” representations of units, such as y, yard, meter, km, and gallons.
- In this case, output ```Invalid unit\n" and exit the program

(4)

- Keep track of the sum of values entered (as well as the smallest and the largest) and the number of values entered.
- When the loop ends, print
- the smallest
- the largest
- the number of values
- the sum of values.
- Note that to keep the sum, you have to decide on a unit to use
for that sum;
**use meters.**

(5)

- Keep all the values entered (converted into meters) in a vector. At the end, write out those values.

(6)

- Before writing out the values from the vector, sort them (that will make them come out in increasing order).

**Sample execution:**

1.5m 1.5m The smallest so far The largest so far 1.5cm 0.015m The smallest so far 1.5in 0.0381m 1.5ft 0.4572m Smallest: 0.015, largest: 1.5, total: 2.0103 Values: 0.015 0.0381 0.4572 1.5