How to solve $\int \sqrt{1+\sin x}\, dx$? It's easy to get this:
$$\int \sqrt{1+\sin x}\, dx \\= \int \sqrt{ \sin^2{\frac{x}{2}} + \cos^2{\frac{x}{2}} + 2\sin{\frac{x}{2}}\cos{\frac{x}{2}}}\,\, dx  \\ = \int \left | \sin{\frac{x}{2}} + \cos{\frac{x}{2}} \right |\, dx \\= \sqrt{2} \int \left | \sin{\left ( \frac{x}{2} + \frac{\pi}{4} \right )} \right |\, dx$$
So, in fact, my question is how to solve the integrate $\int \left | \sin x \right| dx $.
Or how to deal with the integrate when have absolute in it?

Hint: $|\sin x|=(-1)^n \sin x$ for $\pi n \leqslant x < \pi (n+1)$, where $n=0, \pm 1,\pm2, \cdots$.
To keep antiderivative continuous in $x=\pi (n+1)$ you need to solve
$$\left((-1)^{n+1}\cos x +C_n\right) \Big|_{x=\pi (n+1)}=\left((-1)^{n+2}\cos x +C_{n+1}\right)\Big|_{x=\pi (n+1)}$$
taking some $C=C_0$.
