help understanding instructions

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))
Do you have a code of what you have done so far? Only so can anyone help. However try this code for the first your task:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace 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.
Last edited on
Topic archived. No new replies allowed.