Mathematical programs with nonlinear complementarity constraints are reformulated using better-posed but nonsmooth constraints. We introduce a class of functions, parameterized by a real scalar, to approximate these nonsmooth problems by smooth nonlinear programs. This smoothing procedure has the extra benefits that it often improves the prospect of feasibility and stability of the constraints of the associated nonlinear programs and their quadratic approximations. We present two globally convergent algorithms based on sequential quadratic programming, SQP, as applied in exact penalty methods for nonlinear programs. Global convergence of the implicit smooth SQP method depends on existence of a lower-level nondegenerate (strictly complementary) limit point of the iteration sequence. Global convergence of the explicit smooth SQP method depends on a weaker property, i.e. existence of a limit point at which a generalized constraint qualification holds. We also discuss some practical matte...