Hello guys..
I'd like someone to explain to me how to implement some functions in a program the simplest way..
I've an assignment.. and we only practiced the functions twice.. so am not good at it at all... can someone provide simple examples so that i can understand the full idea..

and yeah.. i want functions that work on numbers, and others that work on talking only without numbers..

thx for ur time

Recommended Answers

All 3 Replies

Okay, I wasted my time reading that post thrice trying to figure out what the hell you need help with. Would you care to ask a question that actually makes sense? What are these "the functions" you keep vaguely mentioning?

You are going to have to clarify your request quite a bit more. There are trillions of ways to write functions, so what exactly has your instructor asked you to do ?

Hi...
Sorry guys .. but i thought that the functions are written always the same way.. I dunnu abt them..

this is the question..,, But i want examples on how to solve such question..
thx
-----------


Part1:
Body Mass Index (BMI) is a number calculated from a person’s weight and height. BMI provides a reliable indicator of body fatness for most people and is used to screen for weight categories that may lead to health problems.
Kilograms and meters
(or centimeters) Formula: weight (kg) / [height (m)]2
With the metric system, the formula for BMI is weight in kilograms divided by height in meters squared. Since height is commonly measured in centimeters, divide height in centimeters by 100 to obtain height in meters.
Example: Weight = 68 kg, Height = 165 cm (1.65 m)
BMI = Weight / (Height)2 =68 ÷ (1.65)2 = 24.98
In this program you should do the following:
1. Give instructions to the user explaining Body Mass index (see sample output below) using a function called Instructions that has no input and does not return a value.
2. Calculate Body Mass Index according to the following formula:
(BMI =Weight / (Height)2).
Notice:
 The user enters his height in cm. Since height is commonly measured in centimeters, divide height in centimeters by 100 to obtain height in meters.
 Height and weight are integers.

Then use the following table to display to the user his weight status.
BMI Weight Status
Below 18.5 Underweight
18.5 – 24.9 Normal
25.0 – 29.9 Overweight
30.0 and Above Obese

3. The program should be repeated until the user enters his weight = 0 to quit.

Sample Output: (attached)

==========
Part2
1. Make a second function called Weight. It lets the user enter the int weight in g and returns int weight in kg. (Make it a void function)
2. Make a third function called Height. It lets the user enter the int height in cm and returns double height in meter.
3. Make a fourth function called Bmi to calculate body mass index. It takes the int weight and double height in meter, and returns bmi, which is of type double.
4. Make a fifth function called Showresult that takes the bmi form the main program and doesn't return a value. It should display result according to the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.