Using that the orthogonal group $O(2n)$ consists of two connected components, which are $SO(2n)$ and $RSO(2n)$ (where $R=\operatorname{diag}(-1,1\ldots,1)$), one can construct a diffeomorphism $\phi:O(2n)\to SO(2n)\times\mathbb{Z}/2\mathbb{Z}$ which sends $A\in SO(2n)$ to $(A,\overline0)$ and $R A\in O(2n)\setminus SO(2n)$ to $(A,\overline1)$. I have to describe the multiplication on $SO(2n)\times\mathbb{Z}/2\mathbb{Z}$ which $SO(2n)\times\mathbb{Z}/2\mathbb{Z}$ inherits from $O(2n)$, which should be that of the semidirect product $SO(2n)\rtimes\mathbb{Z}/2\mathbb{Z}$, but I am stuck. Can someone offer any help or hints?
Edit: I had the idea of defining the multiplication as follows: $(A,\overline m)(B,\overline k)=(R^mAR^kB,\overline{m+k})$, however this does not seem to be associative..