I'm totally confused by the TRY THIS. I'm not sure what I'm supposed to do and I don't want to skip it, because if I do I know my confusion will only snowball.
Am I supposed to edit the f function and add or remove some code?
What should I put in int main()?
Also, do I need to include the area and framed_area functions into my program in order to test things?
This is what I have right now, which needless to say, isn't much:
#include "std_lib_facilities.h"
int area(int length, int width)
{
if(length<=0 || width<=0)
return -1;
return length*width;
}
int framed_area(int x, int y)
{
constint frame_width=2;
if(x-frame_width<=0 || y-frame_width<=0)
error("non-positive area() argument called by framed_area()");
return area(x-frame_width, y-frame_width);
}
int f(int x, int y, int z)
{
int area1=area(x,y);
if(area1<=0) error("non-positive area");
int area2=framed_area(1,z);
int area3=framed_area(y,z);
double ratio=double(area1)/area3;
}
int main()
{
}
It appears to me as if the f function needs a return value. But I'm confused because there are several different integers being defined in that function. How to return them all? And how to call that function in the int main(). Any help is much appreciated.