An implicit finite-difference code for inviscid and viscous cascade flow