vendredi 3 novembre 2017

How to replace old value in C++ loop?

I am trying to write a program that will run through angles a catapult could shoot from, from 0-90, and calculate the the distance each will result in. When an angle results in a farther distance than the last, it should replace the previous angle in a variable called "bestAngle". This is what I have so far:enter image description here

I think the problem has something to do with the last if statement, as I think the best angle is not updating. I don't expect anyone to tell me exactly what to do, but if someone could point me to the location of the error that would be helpful.

Aucun commentaire:

Enregistrer un commentaire