I am a newbie in C++ and it is a very easy task but all tutorials that I looked use cout some string in if-else conditions.
I want to update a global variable in if-else statement.
Here is the code;
double theta_radian{};
if (l2 >= l1)
{
double theta_radian = atan2(e2.y(), e2.x());
std::cout << "theta_local" << theta_radian << std::endl;
}
else
{
double theta_radian = atan2(e1.y(), e1.x());
}
std::cout << "theta_radian" << theta_radian << std::endl;
I want to update theta_radian variable based on the if-else condition.
I don't want to create a vector and push_back to it since it is a simple practice and I want to learn how to do it properly.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire