This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

invalid binary operands error in this code can any one help me please  RSS feed

 
Rizwan Lateef
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-(float *) angleInRadians{
int *n = numberOfSides;
float *result = ((n - 2) * 180);
result /= numberOfSides;
float *angle = (result * (M_PI / 180));
return angle;
}
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int and float are not pointer object types, you should remove the "*"

int n = numberOfSides;
float result = ((n - 2) * 180);

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To do it all for you

-(float) angleInRadians{
int n = numberOfSides;
float result = ((n - 2) * 180);
result /= numberOfSides;
float angle = (result * (M_PI / 180));
return angle;
}

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!