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

+1 vote
asked Nov 25, 2019 by Mior Aiman (180 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
/********* 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;

system ("pause");
return 0;
float calculate (float weight, float height)
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;
        cout<< "you is okay"<<endl;

1 Answer

0 votes
answered Nov 27, 2019 by rohan ag (1,150 points)
selected Nov 30, 2019 by Mior Aiman
Best answer
you just declare the result function before the main


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.