Solving a Separable First Order ODE Using Initial Conditions
Your solution looks right so far.
The next step would be to use the initial condition given, y(0) =1. Which is translated to mean that when x=0 then y=1. By substituting this into the general equation you have already found, the sole, remaining unknown C can be solved for. In this case it looks like C=0
Edit: After arriving at:
$-ln(2-y) = -ln|cos x| + C$
Taking the exponents on both sides will give:
$e^{ln(2-y)^{-1}} = e^{(ln|cos x|^{-1} + C)}$
Which, using the laws of exponents, can be written as:
$e^{ln(2-y)^{-1}} = e^Ce^{ln|cos x|^{-1}}$
And simplified to be:
$(2-y)^{-1}= e^C|cos x|^{-1}$
$\frac{1}{2-y}= e^C \frac{1}{|cos x|}$
$y = 2-\frac{ |cos x| }{e^C} $
Again, as before, using the initial condition given, $y(0) =1$ (that is $y=1$ when $x=0$) - we find that $C = 0$ or $e^C = 1$.