Does the knowledge of $Z(G)$ and $G/Z(G)$ give the full group? I'm wondering if by knowing the center $Z(G)$ as well as $G/Z(G)$ one can
deduce G.
I thought that you should be able to write $G=Z(G) \times G/Z(G)$, because every
element either lies in the center or it does not, and central elements can
always be "separated" from the rest by commuting e.g. to the left.
Yet a bit of experimenting with GAP has shown that this is clearly not true,
however I don't see my mistake and would be very grateful if anyone could point it out to me.
 A: No, one cannot. For instance the dihedral group $D_8$ has centre $Z(D_8)\cong C_2$ and $D_8/Z(D_8)\cong C_2\times C_2$, but $D_8\ncong C_2\times C_2\times C_2$.
I might paraphrase your argument as follows: Every $g\in G$ lies in exactly one coset $Z(G)h$ and therefore can be written uniquely as $g=zh$ where $z\in Z(G)$. When we multiply two elements $g=zh$ and $g^\prime = z^\prime h^\prime$ we obtain $gg^\prime = zz^\prime hh^\prime$. Since this corresponds to the group law in $Z(G)\times G/Z(G)$, we must have $G\cong Z(G)\times G/Z(G)$. The trouble is that the expression $g=zh$ is not at all unique: for instance $g=zz^\prime\cdot {z^\prime}^{-1}h$ for any $z^\prime\in Z(G)$ does just as well, and consistently choosing representations $g=zh$ for every $g\in G$ would be nothing but giving an isomorphism $G\cong Z(G)\times G/Z(G)$.
A: No, the knowledge of $Z(G)$ and $G/Z(G)$ usually doesn't give $G$. As an example, the quaternion group $Q_8$ and the dihedral group $D_8$ have both center $\mathbb{Z}/2$ and quotient $\mathbb{Z}/2 \times \mathbb{Z}/2$.
The problem with your argument is that if $z$ is central, it may be of the form $z=g^n$ with a non-central $g$. Such a $g$ can't be factored into a central part and a non-central part. 
