The exact solution of the differential equation of mtion of a single degree of freedom system with cubic forces in the form of a combination of different displacement, velocity and acceleration exposed to a periodic excitation, is determined directly in the frequency domain. For this purpose, the well known harmonic balance method is improved. A system of algebraic equations is derived in an explicit form and solved by a recurrent and simultaneous procedure for the case of monoharmonic and polyharmonic excitation respectively. In addition, the latter procedure is employed to analyse the random oscillations caused by a periodic excitation with different phase angles. Some nonlinear effects are illustrated within numerical examples, as for instance jumping phenomenon and nonstationarity of deterministic and random response.