Initially I had to write code to find "d". I managed that by breaking the formula into three sections (ie square root, division, and sine squared).
It is the distance (d) traveled by a cannonball fired at velocity (v) at angle (θ landing at a height (h).
I am finding it very difficult to re-organize this formula and have written more than two pages of twisting and changing but cannot get it. Maybe it is not possible and I will need to break it down into subsections without changing it around??
Specifically I need to: "Extend your program to take three additional inputs v, h and d, and produce θ as output."
Anyway, any and all help will be much appreciated.
Actually I think this is a valid place to post this question.
The poster has identified a programming problem that he wishes to solve using C / C++, and the first step in solvign this problem is to re-arrange the formula he has into a form suitable to code.
If he had just said 'I have this problem, how do I code it' the answer would have been 'first you re-arrange the formula' - he knows that, and so has said that is the first thing he needs help with.
It's not a C++ issue, but part of a problem tha needs a C++ solution.
Wish I could remember enough maths to help (it's been too long since I last had to do trig:-)
Well, wrong forum would be a better reason (should perhaps go to lounge). But it isn't really as bad as many other posts here, not obeying the "No homework", "English actually is case-sensitive" and other rules.
So give a new member not such a hard time.
To the problem: if you had a picture in which the formula would actually be readable, it would really help. Furthermore you should state what you have tried so far. Nobody here is going to give you the solution, but we might be able to give you a pionter if we see what you have done.
That's a beast to do the math. Since you're programming I would do the dirty route and have your program try all angles between 0-90 degrees and when the calculation on the right side matches with the d on the left you print the answer ;-)
edit: btw, if you're going to also include negative heights and negative distances you need to increase the angle range to 0-360 and add some if statements since the sin and cos will come up with the same answers for different angles. Not sure if it would ever actually erroneously produce the d you need since you have a sin and a cos in there, but better safe than sorry.