1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/*Scott Kime
Lab #11
3/30/14
*/
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
void dude(float,float,float,float,float& distance,float& circum,float& area);
int main(int argc, char *argv[])
{
float x, y, xQ, yQ, distance = 0, circum = 0, area = 0;
cout << " Enter your center coordinates x and y seperated by spaces: "
<< endl;
cin >> x >> y;
cout << " Enter your distance coordinates x and y seperated by spaces: "
<< endl;
cin >> xQ >> yQ;
dude(x,xQ,y,yQ, distance, circum, area);
cout << " distance: " << distance << endl;
cout << " radius: " << distance << endl;
cout << " circumference: " << circum << endl;
cout << " Area: " << area << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
void dude(float x,float xQ, float y, float yQ,float& distance, float& circum,
float& area)
{
distance = sqrt(pow(x-xQ,2)+pow(y-yQ,2));
const float pI = 3.1416;
circum = 2 * pI * pow(distance,2);
area = pI * pow(distance,2);
}
| |