- Joined
- Jan 30, 2023
- Messages
- 6
- Reaction score
- 0
I am trying to create some structs that store x,y coordinate data. One of my goals is to store various aspects of each individual point as a variable within each instance of the struct. I am having issues with defining things like this however. Here is my code:
#include PointList.H
#include <cmath>
struct Point{
unsigned int x,y;
unsigned int IntValue(){
return x+y;
}
double YDivdedByX(){
return y/x;
}
unsigned int Polygon = 0
double LRValue(){
return (y-((x+y)/2))
}
double OriginDistance(){
return sqrt((x*x)+(y*y))
}
double RadianValue(){
return asin((y / OriginDistance))
}
Note the "return asin((y / OriginDistance))" in the last entry. It doesn't seem to store OriginDistance as a variable. The language instead seems to be treating them as methods, not variables. How do I set these things up as variables that automatically store certain numbers?
}
#include PointList.H
#include <cmath>
struct Point{
unsigned int x,y;
unsigned int IntValue(){
return x+y;
}
double YDivdedByX(){
return y/x;
}
unsigned int Polygon = 0
double LRValue(){
return (y-((x+y)/2))
}
double OriginDistance(){
return sqrt((x*x)+(y*y))
}
double RadianValue(){
return asin((y / OriginDistance))
}
Note the "return asin((y / OriginDistance))" in the last entry. It doesn't seem to store OriginDistance as a variable. The language instead seems to be treating them as methods, not variables. How do I set these things up as variables that automatically store certain numbers?
}