I (back)*a cake if I had known that they were coming. or I'd have bought a a cake if i(know)that they were coming.