What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Need help with a simple math task in C++

Ace94

New Member
Joined
Jul 20, 2011
Messages
53
If anyone is interested in typing the code, please PM me for more details.
 
People here are verse enough with code to help you for free. Just post your problem.
 
"?nter a triangle and calculate the sine of its maximal angle. The triangle is defined by the coordinates of its vertices. The coordinates are floating-point numbers."

The truth is that I am falling behind class and I can't type the code... trying to get back on track, but I don't have enough time to solve this issue by myself.
 
We won't do your homework for you.
Though think back to trig.
sin(θ) = opposite / hypotenuse

So you coordinates are floating point numbers. That all well and good.
You need to define your three sides.
Coordinate1 = A
Coordinate2 = B
Coordinate3 = C

The distance between these points will be the length of that side.
Remember your distance formula is sqrt((x_2-x_1)^2+(y_2-y_1)^2)

Once you define you sides, you can find the angle by taking the inverse sin.

So θ = sin^-1(o/h)
 
Thanks! I will try to do it later today. If anything pops up, can I ask for advice on PM?
 
Go for it.

There is probably an easier way to do it via loops, but here is a starter.

Ex.

float pointAx = 2.6542
float pointAy = 1.9542
float pointBx = 1.2458
float pointBy = 2.6542
float pointCx = 4.2698
float pointCy = 1.2378

float sideAB = 0.0;
float sideAC = 0.0;
float sideBC = 0.0;

sideAB = sqrt((pointBx)^2-(pointAx)^2)+((pointBy)^2-(pointAy)^2))
 
Back
Top