Hey dude, just to let you know the [/code] tag goes after your code
Try this:
Code:
// Compute area and perimeter of right triangle
#include <iostream>
#include <cctype>
#include <cmath>
using namespace std;
double right_tri_area (double base, double height) { return (base * height)/2; }
// Area formule
double right_tri_perimeter (double a, double b, double h) { return (a + b + h); }
// Perimeter formula
int main()
{
double base, height,
a, b, h, perimeter,
area;
cout << "Enter base and height of the triangle: ";
cin >> base >> height;
area = right_tri_area(base,height);
cout << "Area = " << area << endl;
cout << "Enter the two sides'lengths of sides anhd base of the triangle: ";
cin >> a >> b >> h;
cout << "Perimeter = " << right_tri_perimeter(a, b, h) << endl;
system("pause");
return 0;
}
[edit]Your problem was here:
Code:
double right_tri_area (int base, int height)
{ right_tri_area = (base * height)/2; // system("pause");
return 0; }
double right_tri_perimeter (int a, int b, int h)
{ right_tri_perimeter = (a + b + h);
// system("pause");
return 0; }
You don't set the function value, you want to be returning a value from the function instead. Apart from that your program was fine, but you may want to get int the habit of indenting. [/edit]