Give the function definition for the function with the following function
declaration. Embed your definition in a suitable test program.
void get_double(double& input_number);
//Postcondition:input_number is given a value
//that the user approves of.
You can assume that the user types in the input in normal everyday
notation, such as 23.789, and does not use e-notation to type in the
number. Model your definition after the definition of the function get_int
given in Display 8.3 so that your function reads the input as characters,
edits the string of characters, and converts the resulting string to a number
of type double. You will need to define a function like read_and_clean that
is more sophisticated than the one in Display 8.2, since it must cope with
the decimal point. This is a fairly easy project. For a more difficult project,
allow the user to enter the number in either the normal everyday notation,
as discussed above, or in e-notation. Your function should decide whether
or not the input is in e-notation by reading the input, not by asking the user
whether she or he will use e-notation
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.