I have some problems understanding how the binary files cand be rewritten.
#include <iostream>
#include <cmath>
using namespace std;
constexpr auto PI = 3.14 ;
int main()
{
double x, y;
{
cout << "[>>] Type X: "; cin >> x;
cout << "[>>] Type Y: "; cin >> y;
}
double sum = sin(x) + sin(y);
cout << "[i] Radians: sin(" << x << ") + sin(" << y << ") = " << sum << endl;
cout << "[i] Degrees: sin(" << x << ") + sin(" << y << ") = " << sin(x * PI / 180) + sin(y * PI / 180) << endl;
}
I need a code that edites double sum = sin(x) + sin(y)
to double sum = 2sin((x+y)/2)cos((x-y)/2)
from binary file after the code outputs the result of the sinus summary if randomed boolean is true and does double sum = 2sin((x+y)/2)cos((x-y)/2)
to double sum = sin(x) + sin (y)
if randomed boolean is false. Is there any solution?