hey guys so here i have a problem where is asking me that i need a primary expression before else mi don't get why its not working any help would be nice thanks in advance

#include<iostream> //library for input or/and output

#include<iomanip>//does equations

#include<cmath>//library for math formulas

using namespace std;

int main ()// main equation of the program

{

char YN = 'Y' ;

// while loop execution

while( YN== 'Y')

{ //start of a section for the while loop

//variables

float x, y , Diameter_of_circle, points_loc;

float degrees, x2, y2, radius, full_circle, first_angle, last_angle;

int points;

cout<<setprecision(2); //specifies the number of digits after decimal point

cout<<fixed<<showpoint;

cout<< "Enter the number of points: ";

cin>> points;

cout<< "Enter the Diameter of the circle: ";

cin >> Diameter_of_circle;

cout<< "Location of circle center on x: " ;

cin>> x;

cout<< "Location of circle center on Y: " ;

cin>> y;

{ //Start section to do a while loop

// Local variable declaration:

int YN;

cout<< "Is this a full bolt circle? YES(Y) or NO(N) " ;

cin >> YN;

// while loop execution

if ( YN = 2);

{

cout<< "Location of the first Angle: ";

cin>> first_angle;

cout<< endl;

//math equations for giving the points and angle

degrees= 6.2831*(180/M_PI);

points_loc= (degrees / points);

radius= (Diameter_of_circle/2);

//output - for loop

for ( float i= first_angle; i<points+first_angle; i++)

{

//start of section for-loop

cout<< "At: "; cout<< setprecision(2)<< points_loc*i; cout<< " degrees ";

cout<< " X: "; cout<< (x +( radius*cos(points_loc*i)));

cout<< " Y: "; cout<< (y + (radius*sin(points_loc*i)));

cout<< endl;//end of section for-loop

}

}

else(YN > 2 )

{

cout<< "Location of the first Angle: ";

cin>> first_angle;

cout<< "Location of the Last Angle: ";

cin>> last_angle;

cout<< endl;

//math equations for giving the points and angle

degrees= 6.2831*(180/M_PI);

points_loc= (degrees / points);

radius= (Diameter_of_circle/2);

//output - for loop

for ( float i= first_angle; i<points+first_angle<180; i++)

{

//start of section for-loop

cout<< "At: "; cout<< setprecision(2)<< points_loc*i; cout<< " degrees ";

cout<< " X: "; cout<< (x +( radius*cos(points_loc*i)));

cout<< " Y: "; cout<< (y + (radius*sin(points_loc*i)));

cout<< endl;}//end of section for-loop

}

}

}

cout << "would you like to do it again? YES(Y) or NO(N)"<< endl;

cin>> YN;

//end loop for asking

//end of section for while loop

}

system("Pause");

return 0 ;

}

#include<iostream> //library for input or/and output

#include<iomanip>//does equations

#include<cmath>//library for math formulas

using namespace std;

int main ()// main equation of the program

{

char YN = 'Y' ;

// while loop execution

while( YN== 'Y')

{ //start of a section for the while loop

//variables

float x, y , Diameter_of_circle, points_loc;

float degrees, x2, y2, radius, full_circle, first_angle, last_angle;

int points;

cout<<setprecision(2); //specifies the number of digits after decimal point

cout<<fixed<<showpoint;

cout<< "Enter the number of points: ";

cin>> points;

cout<< "Enter the Diameter of the circle: ";

cin >> Diameter_of_circle;

cout<< "Location of circle center on x: " ;

cin>> x;

cout<< "Location of circle center on Y: " ;

cin>> y;

{ //Start section to do a while loop

// Local variable declaration:

int YN;

cout<< "Is this a full bolt circle? YES(Y) or NO(N) " ;

cin >> YN;

// while loop execution

if ( YN = 2);

{

cout<< "Location of the first Angle: ";

cin>> first_angle;

cout<< endl;

//math equations for giving the points and angle

degrees= 6.2831*(180/M_PI);

points_loc= (degrees / points);

radius= (Diameter_of_circle/2);

//output - for loop

for ( float i= first_angle; i<points+first_angle; i++)

{

//start of section for-loop

cout<< "At: "; cout<< setprecision(2)<< points_loc*i; cout<< " degrees ";

cout<< " X: "; cout<< (x +( radius*cos(points_loc*i)));

cout<< " Y: "; cout<< (y + (radius*sin(points_loc*i)));

cout<< endl;//end of section for-loop

}

}

else(YN > 2 )

{

cout<< "Location of the first Angle: ";

cin>> first_angle;

cout<< "Location of the Last Angle: ";

cin>> last_angle;

cout<< endl;

//math equations for giving the points and angle

degrees= 6.2831*(180/M_PI);

points_loc= (degrees / points);

radius= (Diameter_of_circle/2);

//output - for loop

for ( float i= first_angle; i<points+first_angle<180; i++)

{

//start of section for-loop

cout<< "At: "; cout<< setprecision(2)<< points_loc*i; cout<< " degrees ";

cout<< " X: "; cout<< (x +( radius*cos(points_loc*i)));

cout<< " Y: "; cout<< (y + (radius*sin(points_loc*i)));

cout<< endl;}//end of section for-loop

}

}

}

cout << "would you like to do it again? YES(Y) or NO(N)"<< endl;

cin>> YN;

//end loop for asking

//end of section for while loop

}

system("Pause");

return 0 ;

}

Topic archived. No new replies allowed.