/*

Program 5.3: Demo on value-returning function that has parameters

*/

#include <iostream>

#include <cmath>

using namespace std;

float calculate (float weight,float height); /*C++ statement to define add function*/

void result(); /*(a) C++ statement to define multiply

function*/

/********* main function *********/

/* Task 1: Prompt and read two integer numbers

Task 2: Call and transfer these numbers to add or multiply function

Then, receive the result from add or multiply function.

Task 3: Display the result

**************************************/

int main(){//begin main

//declaration of local identifiers

float weight, height, display, bmi;

//Prompt and read two numbers

cout << "Enter weight in kg: " << endl;

cin >> weight ;

cout << "Enter height in m\n";

cin >> height;

result(bmi);

calculate(weight,height);

system ("pause");

return 0;

}

float calculate (float weight, float height)

{//begin

float a;//declaration of local identifiers

a = weight/pow (height,2); ;//Calculate

return (a);//Return the total to the caller.

}//end add

void result(double bmi){

if (bmi >= 25)

cout<< "you is overweight"<<endl;

if (bmi <= 18.5)

cout<< "you is underweight"<<endl;

else

cout<< "you is okay"<<endl;

return;

}