Hello TCK,
If you take a close look at the function what is it doing?
1 2 3 4
|
void printArea(double area)
{
cout << "The area of triangle is " << printArea(area) << "cm" << char(253) << endl;
}
|
The function returns a "void", so on line 36, line 3 above, when you call a void function what do you expect to get back?
In "main" your first line is to define two variables, but they are uninitialized. This is an error on my compiler. Because the next is using these uninitialized variables. The use of "auto" works, but better to call it a "double".
In the "input" function you are returning a double, but the return is trying to return two items. A function can only return
one item. This could be a pointer to an array or a vector to return one than one item.
Inside the function starting with the function parameters you are receiving the variables "bs" and "ht" then inside the function you define "BS" and "HT". These really are not needed as the function parameters are all you need. Then you get user input to "BS" and "HT", but want to return "bs" and "ht". What is your idea here? If you pass "bs" and "ht" by reference and do your "cin" to these variables you can make the function a "void" return and what is entered into "bs" and "ht" will be reflected back in main.
The "calculateArea" function appears to be right although I would make the variables constant as in
double calculateArea(const double bs, const double ht)
.
After I made the changes the program compiled and worked.
Hope that helps,
Andy
Edit: