try changing line 7. with cp-=1; ... because you declare a before b, therefore b comes after a.