Please help me with my code I can\'t figure out why I keep having error. //Heade
ID: 3627308 • Letter: P
Question
Please help me with my code I can't figure out why I keep having error.//Header file section
#include <iostream>
#include <math.h>
using namespace std;
double distance (int p, int q, int r, int s);
double radius (int p, int q, int r, int s);
double circumference (double r1);
double area (double r1);
void main ()
{ //start main
int x1, x2, y1, y2;
double r,d,c,a;
cout<<"Enter the center of circle"<<endl;
cin>>x1>>y1;
cout<<"Enter point on circle"<<endl;
cin>>x2>>y2;
d=distance (x1,y1,x2,y2); //distance function call
r=radius (x1,y1,x2,y2); //radius function call
c=circumference (r); //circumference function call
a=area (r); //area function call
//outputing values
cout<<"distance between points"<<d<<endl;
cout<<"radius of circle"<<r<<endl;
cout<<"circumference of circle"<<c<<endl;
cout<<"area of circle"<<a<<endl;
system ("pause");
} //end main
//function definitions
double distance (int p, int q, int r, int s);
{ //start function
double d1;
d1=sqrt (pow (r-p, 2) + pow(s-q,2));
return d1;
} //end distance
double radius (int p, int q, int r, int s);
{ //start function
double r1;
r1=distance(p,q,r,s);
return r1;
} //end radius
double circumference (double r1)
{ //start function
double c1;
c1=2*3.1416*r1;
return c1;
} //end circumference
double area (double r1)
{ //start function
double a1;
a1=3.1416*r1*r1;
return a1;
} //end area
Explanation / Answer
// i am able to compile and run y not u ?
// r u giving input ? LET ME KNOW WHAT ERRORS U ARE GETTING :)
// compile code is at :
// click on clone and copy and download code.
// working now ENJOY
//Header file section
#include <iostream>
#include <math.h>
using namespace std;
double distance (int p, int q, int r, int s);
double radius (int p, int q, int r, int s);
double circumference (double r1);
double area (double r1);
void main ()
{ //start main
int x1, x2, y1, y2;
double r,d,c,a;
cout<<"Enter the center of circle"<<endl;
cin>>x1>>y1;
cout<<"Enter point on circle"<<endl;
cin>>x2>>y2;
d=distance (x1,y1,x2,y2); //distance function call
r=radius (x1,y1,x2,y2); //radius function call
c=circumference (r); //circumference function call
a=area (r); //area function call
//outputing values
cout<<"distance between points"<<d<<endl;
cout<<"radius of circle"<<r<<endl;
cout<<"circumference of circle"<<c<<endl;
cout<<"area of circle"<<a<<endl;
system ("pause");
} //end main
//function definitions
double distance (int p, int q, int r, int s)
{ //start function
double d1;
d1=sqrt (pow (r-p, 2) + pow(s-q,2));
return d1;
} //end distance
double radius (int p, int q, int r, int s)
{ //start function
double r1;
r1=distance(p,q,r,s);
return r1;
} //end radius
double circumference (double r1)
{ //start function
double c1;
c1=2*3.1416*r1;
return c1;
} //end circumference
double area (double r1)
{ //start function
double a1;
a1=3.1416*r1*r1;
return a1;
} //end area