I want to compute the cohomology ring of complex projective space with coefficient $\mathbb{Z}$. I have known that the homology groups: $$ H_*(\mathbb{CP}^n,\mathbb{Z})=\begin{cases} \mathbb{Z} \quad &0,2,\dots,2n\\ 0 &else\end{cases}$$ And I also know a method to compute the ring structure of $H^*(\mathbb{RP}^n,\mathbb{Z}/2)$, by constructing some generators. But I cannot find the relationships between them.
Any Hints, references are welcomed. THANKS! (I am a newer to algebraic topology so I wish to convince myself with an elementary proof.)
Given that the $H_{k}(\mathbb{C}P^n)$ are always free (either 0 or $\mathbb{Z}$), $\text{Ext}(H_{n-1},\mathbb{Z})$ is always 0. So https://en.wikipedia.org/wiki/Universal_coefficient_theorem gives $H^k(\mathbb{C}P^n, \mathbb{Z}) \cong \text{Hom}(H_k(\mathbb{C}P^n,\mathbb{Z}), \mathbb{Z})$. It follows that the cohomology rings are the same as the homology rings.
Edit: This does not compute the ring structure, which perhaps is the only hard part, but you just need to show that $x^2 ⌣ x^k = x^{k+2}$ which seems similar to the real case replacing $\mathbb{C}$ with $\mathbb{R}^2$. So then the ring structure is just the same as $H^*(\mathbb{R}P^n, \mathbb{Z}/2).$ Hatcher gives a more thorough proof on page 220 https://pi.math.cornell.edu/~hatcher/AT/ATpage.html and things also become easier if you invoke Poincare duality.