Step 1: Understanding the integral.
We are given the equation:
\[
\int 2 \, dy = (y + \cos x) \, dx
\]
Integrating both sides with respect to their respective variables:
\[
2y = \int (y + \cos x) \, dx
\]
Step 2: Integrate the right-hand side.
The integral of \( y \) with respect to \( x \) is \( yx \), and the integral of \( \cos x \) with respect to \( x \) is \( \sin x \). Therefore:
\[
2y = yx + \sin x + C
\]
Step 3: Solve for \( y \).
Thus, we have:
\[
y = \sin x + \cos x + C
\]
Final Answer: \( y = \sin x + \cos x + C \).