i did this problem but i don\'t know why i keep getting this error.(12C:\\Users\
ID: 3617623 • Letter: I
Question
i did this problem but i don't know why i keep getting this error.(12C:UsersFaizan MianDocumentslab 8.cpp expected init-declaratorbefore "int" ) #include <cstdlib> #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 int main(int argc, char *argv[]) {int x1,x2,y1,y2; double r,d,c,a: cout<<"enter the center of circle"<<endl; cin>>x2>>y2; d=distance(x1,y1,x2,y2); r=radius(x1,y1,x2,y2); c=cirsumference(r); a=area(r);
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"); return EXIT_SUCCESS; } double distance (int p,int q,int r,int s) { double d1; d1=sqrt(pow(r-p,2)+pow(s-q,2)); return d1; } double raduis (int p,int q,int r,int s) { double r1; r1=distance(p,q,r,s); return r1; } double circumference (double r1) { double c1; c1=2*3.1416*r1; return c1; } double area (double r1) { double a1; a1=3.1416*r1*r1; return a1; }
but i don't know why i keep getting this error.(12C:UsersFaizan MianDocumentslab 8.cpp expected init-declaratorbefore "int" ) #include <cstdlib> #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 int main(int argc, char *argv[]) {int x1,x2,y1,y2; double r,d,c,a: cout<<"enter the center of circle"<<endl; cin>>x2>>y2; d=distance(x1,y1,x2,y2); r=radius(x1,y1,x2,y2); c=cirsumference(r); a=area(r);
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"); return EXIT_SUCCESS; } double distance (int p,int q,int r,int s) { double d1; d1=sqrt(pow(r-p,2)+pow(s-q,2)); return d1; } double raduis (int p,int q,int r,int s) { double r1; r1=distance(p,q,r,s); return r1; } double circumference (double r1) { double c1; c1=2*3.1416*r1; return c1; } double area (double r1) { double a1; a1=3.1416*r1*r1; return a1; }
#include <cstdlib> #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 int main(int argc, char *argv[]) {int x1,x2,y1,y2; double r,d,c,a: cout<<"enter the center of circle"<<endl; cin>>x2>>y2; d=distance(x1,y1,x2,y2); r=radius(x1,y1,x2,y2); c=cirsumference(r); a=area(r);
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"); return EXIT_SUCCESS; } double distance (int p,int q,int r,int s) { double d1; d1=sqrt(pow(r-p,2)+pow(s-q,2)); return d1; } double raduis (int p,int q,int r,int s) { double r1; r1=distance(p,q,r,s); return r1; } double circumference (double r1) { double c1; c1=2*3.1416*r1; return c1; } double area (double r1) { double a1; a1=3.1416*r1*r1; return a1; }
Explanation / Answer
void main int main(int argc, char *argv[])The two statements won't work.
One or the other.
Since you are returning EXIT_SUCCESS just drop the line 'void main'and the program should work.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.