Struct Member Variables Problem

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?

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top