C++ math equation

This is a discussion on C++ math equation within the C++ Programming forums, part of the General Programming Boards category; So the get the area of the largest circle I can use the shortest side of the rectangular piece for ...

1. So the get the area of the largest circle I can use the shortest side of the rectangular piece for the circle equation.

A= Pi * r^2 r being the shortest side / 2. If I get this right.

2. Looks correct to me.

3. I would use If to get the shortest side. Is there an easier short way?

Well, actually If I use length and width... width would be the shortest side.

4. Try writing the whole program by yourself, using the methods you know. Post back if you have any problems or are getting errors you don't understand.

Most likely, many methods used by some of the programmers here are beyond you and wouldn't be accepted by your prof. So use what you know and let us know if you hit a road block.

5. Well, like I said.. I will use the length ( not width, sorry) as my shortest side.

6. Ok ,this is what I have now. We also had to convert it to acre. That's why I divided it.

Code:
```// Headers and Other Technical Items

#include <iostream>
using namespace std;

// Function Prototypes

void get_data(void);
void process_data(void);
void show_results(void);
void pause(void);

// Variables

double  length;
double  width;
double total_rectangular;
float pi;
float farmable_area;
float nonfarmable;

//******************************************************
// main
//******************************************************

int main(void)
{
get_data();
process_data();
show_results();

return 0;
}
// Input

void get_data(void)
{

cout << "\nEnter the length of the property in feet --->: ";
cin >> length;
cout << "\nEnter the width of the property in feet ---->: ";
cin >> width;

return;
}
// Process

void process_data(void)
{
pi = 3.14159265;
total_rectangular = (length * width)/ 43560;

farmable_area=pi*(width/2)*(width/2)/43560;

nonfarmable = total_rectangular - farmable_area/43560;

return;
}

// Output -

void show_results(void)
{
cout << "\n";
cout << "\nThe total area of the property is ---->: ";
cout << total_rectangular;
cout << "\nThe total area that is farmable is ---->: ";
cout << farmable_area;

pause();
return;
}

//******************************************************
// pause
//******************************************************

void pause(void)
{
cout << "\n\n";
system("PAUSE");
cout << "\n\n";
return;
}```

7. Where does this number 43560 come from? Oh it's an acre, I see.
However, the unfarmable area is already in acres.

Also I would not assume that width is smaller, you probably should check and use whichever value is smaller. Or at least make it clear to the user that they need to type the smaller value into width.

8. Thank you for the hint!

Page 2 of 2 First 12