Return Value Of Functions

#include <iostream>
#include <iomanip>
using namespace std;
double area(double, double);
int main()
{
double x = 3.5, y = 1.2, res;
res = area( x, y+1);
cout << fixed << setprecision(2);
cout << " The area of a rectangle "
<< " with width " << setw(5) << x
<< " and length " << setw(5) << y+1
<< " is " << setw(5) << res
<< endl;
return 0;
}
double area( double width, double len) {
return (width * len);
}
Related examples in the same category