I have an assignment but I am confused about what is being asked. Can anyone explain?
Create a source file that has the following functions:
i. a function that receives a string value as an argument, prints the string as a message and
then gets and returns a float from the user,
(float get_float(string message))
ii. a function that takes three float values as arguments, and returns the first argument if it is
between (inclusive) the second and third arguments, or a -1.0 if the number is not within the
range of the second and third numbers,
(float check_valid_input(float check, float low, float high))
iii. a function that takes two float values (one representing width and one representing height)
and returns the area of a rectangle based on those values,(float calc_rect_area(float width, float height))
#include <iostream>
usingnamespace std;
void printFloat(string);
int main()
{
string message = "\nEnter a number(for ex. 12.34): "; // the message which the function will receive
printFloat(message); // function call with that message
return 0;
}
void printFloat(string message)
{
float number; // float number declaration
cout << message; // print the string as a message
cin >> number; // and then gets
cout << "\nYou entered the float number " << number << '\n'; // and returns a float from the user
}
Try to write using this model the rest of you assignment.