Here's the first problem:
calc(int a,int b,int c, int &s,int &area);
Not sure what was your intention here, were you trying to declare the function or calling the function? Or Both? If you are trying to declare the function, you have to put it between main() and "using namespace std".
using namespace std;
void calc(int a, int b, int c, int &s, int &area);
int main()
If you are trying to call the function, you don't specify the data type (int, double, float, string, etc). Another problem are these 2 variables, "s" and "area" in the parenthesis:
calc(int a,int b,int c, int &s,int &area);
"s" and "area" is declared within the function calc(), but it is not declare in main(). You cannot used a variable that was declare within a function and expect to used it in a different function, unless it is global. So since the calc() function prints out the parameter and area, you don't need to pass in "s" and "area" as arguments to the calc() function, also delete the data types:
calc(a, b, c);
return 0;
So now, you can safely delete the parameters "s" and "area" here:
void calc(int a,int b,int c)
{
Next, you declare "s" and "area" inside calc():
void calc(int a,int b,int c)
{
double s = blah blah
double area = blah blah
.......
......
}
Now to put the answers in 3 decimal places, you need to include the iomanip library:
#include
And then for your cout statements, do this:
cout << "The perimeter is: " << setprecision(3) << s;
cout << "The area is: " << setprecision(3) << area;
Edit: Change a, b, and c to double in order to fully output a decimal number.