1. ## need your professional opinion....

Can someone tell me if this program matches this assignment EXACTLY. It needs to be perfect for full credit. Thanks.

Instructions:
Write a function with 4 arguments so that the first 2 arguments will accept the length & width of a rectangle, the 3rd argument will be set to the perimeter, the 4th argument set to the area. The main program should call the required function twice: 1st call with input arguments of 1.5 and 5.0; second call with input arguments of 123.45 and 5.0. After each call to the function, the main program should print out the results - the function should not do any printing.

Here's what I have:
Code:
```#include <iostream>
#include <cmath>
using namespace std;

//Functions used ...
void instructions();
float length;
float width;
void all(float length, float width, float& area, float& perim);
float areaf(float length, float width, float& area);
float perimf(float length, float width, float& perim);

//---------------------------------------------------------------------------------

int main ()
{
float area ;
float perim ;

instructions();

all( 1.5, 5.0, area, perim);

cout << "A rectangle with a length of 1.5 "
<< "and a width of 5.0 has an area of "
<< area << endl;
cout << "and a perimeter of "
<< perim << endl;
cout << endl;

all(123.45, 5.0, area, perim);

cout << "A rectangle with a length of 123.45 "
<< "and a width of 5.0 has an area of "
<< area << endl;
cout << "and a perimeter of "
<< perim << endl;
cout << endl;
return 0;
}

void all(float length, float width, float& area, float& perim)
{
area = areaf(length, width, area);
perim = perimf(length, width, perim);
}

float areaf(float length, float width, float& area)
{
area = 0;
area = length * width;

return area;
}

float perimf(float length, float width, float& perim)
{
perim = 0;
cout << length << " " << width << endl;
perim = (length * 2) + (width * 2);
cout << perim << endl;

return perim;
}

//---------------------------------------------------------------------------

// User instructions
void instructions ()
{
cout << "This program takes the length and width "
<< "of a rectangle and calculates" << endl;
cout << "the area and perimeter for two "
<< "sets of variables." << endl;
cout << endl;
}	// End instructions function```
Do you think my program matches the instructions exactly?

2. It doesn't match the instructions EXACTLY. But pretty darn close.
Write a function with 4 arguments so that the first 2 arguments will accept the length & width of a rectangle, the 3rd argument will be set to the perimeter, the 4th argument set to the area.
Does your function have 4 arguments, with the first 2 being length and width, 3rd being perimeter, and 4th being area?
The main program should call the required function twice: 1st call with input arguments of 1.5 and 5.0; second call with input arguments of 123.45 and 5.0
Does your main function call the required function twice? Does it pass in 1.5 and 5.0 the first time and 123.45 and 5.0 the second time?
After each call to the function, the main program should print out the results - the function should not do any printing.
Does your main program print out the results? Is there any printing outside your main function?

3. Hmmm...I see what you're saying....

4. I think I got it fixed except for the 4 function calls:

Code:
```#include <iostream>
#include <cmath>
using namespace std;

//Functions used ...
void instructions();
float length;
float width;
void all(float length, float width, float& area, float& perim);
float areaf(float length, float width, float& area);
float perimf(float length, float width, float& perim);

int main ()
{
float area ;
float perim ;

instructions();

all( 1.5, 5.0, area, perim);

cout << "A rectangle with a length of 1.5 "
<< "and a width of 5.0 has an area of "
<< area << endl;
cout << "and a perimeter of "
<< perim << endl;
cout << endl;

all(123.45, 5.0, area, perim);

cout << "A rectangle with a length of 123.45 "
<< "and a width of 5.0 has an area of "
<< area << endl;
cout << "and a perimeter of "
<< perim << endl;
cout << endl;
return 0;
} //end of main

//------------------------------

void all(float length, float width, float& area, float& perim)
{
area = areaf(length, width, area);
perim = perimf(length, width, perim);
}
//-------------------------------
float areaf(float length, float width, float& area)
{
area = 0;
area = length * width;

return area;
}
//------------------------------
float perimf(float length, float width, float& perim)
{
perim = 0;
perim = (length * 2) + (width * 2);

return perim;
}

//---------------------------------------------------------------------------------

// User instructions
void instructions ()
{
cout << "This program takes the length and width "
<< "of a rectangle and calculates" << endl;
cout << "the area and perimeter for two "
<< "sets of variables." << endl;
cout << endl;
}	// End instructions function```
I'm not too sure how to change it to have 4 arguments, but how does the rest look?

5. Issues like these should really be solvable on your own. I know you just want to make sure, but seriously you should do the best you can and be proud of yourself even if you don't get the perfect grade.

If you want to make sure you follow the instructions exactly, then go through each and every detail of the instructions and verify that your code matches it. If you are unsure of the instruction, then ask your instructor. If your instructor is unavailable or has banned you from his or her office for asking too many questions (), it would still be better to ask a specific question for help understanding an instruction than to say, "please tell me if I did it right."

Assuming you figured out the part about removing the cout from the perimf function on your own, you did well in fixing that part. While I don't see anything in the instructions about 4 function calls, I do see one nitpicky detail that doesn't match exactly. I'm sure you can figure it out.

6. Thanks jlou. No, I haven't been banned (actually today was the first time I've asked the instructor a question regarding homework.)
Yes I did figure out to remove the cout from perimf - with a little suggestion earlier.
The only reason I asked for someone to check it out is because my instructor is extremely nitpicky - and rightfully so. I wouldn't want a tiny little error in my program to be responsible for a tragedy.

7. Well, do what your instructor will do. Make a checklist. Read each sentence carefully and completely, and write up a checklist that exactly matches each point that each sentence requires. For example, take the first sentence:

Write a function with 4 arguments so that the first 2 arguments will accept the length & width of a rectangle, the 3rd argument will be set to the perimeter, the 4th argument set to the area.

[ ] Function has 4 arguments
[ ] First argument is length (input)
[ ] Second argument is width (input)
[ ] Third argument is perimeter (output)
[ ] Fourth argument is area (output)

And do this for each sentence.

Then print this checklist, and go through and verify that each point matches exactly. Check off each when it works exactly as it was specified.

When you do this, it's very hard to accidently miss something.

When I grade assignments, this is pretty much what I do.

8. Thanks, that's a great idea.
It's good to have some insight from "the other side"