main.cpp:29:11: error: too many arguments to function ‘void result()’

0 votes
asked Nov 25 by (170 points)
/*
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;
}

1 Answer

0 votes
answered Nov 27 by (1,180 points)
selected Nov 30 by
 
Best answer
you just declare the result function before the main

like

#include<iostream>
using namespace std;
void result(double );
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...