The iterative boundary-element method, which is originally developed before for submerged cavitating hydrofoils is extended and modified to predict the wave pattern and lift and drag values of surface piercing cavitating hydrofoils (vertical struts) moving with a constant speed on the free surface. The iterative numerical method, which is based on the Green's theorem, allows the separation of surface piercing cavitating hydrofoil (or vertical strut) problem and the free surface problem. Those problems are solved separately, with the effects of one on the other being accounted for in an iterative manner. The wetted surface of the body (hydrofoil or strut) and the free surface are modelled with constant strength dipole and constant strength source panels. In order to prevent upstream waves the source strengths from some distance in front of the body to the end of the truncated upstream boundary are enforced to be zero. No radiation condition is enforced for downstream and transverse boundaries on the free surface. The method is applied to a rectangular non-cavitating hydrofoil with a yaw angle to compare the results with those of experiments and other numerical methods given in the literature. Then, the method is applied to a rectangular cavitating vertical strut and the effects of Froude number on wave pattern and lift and drag values of vertical strut are discussed.