I have an assignment in CS class to create an affine cipher where the equation for encrypting a character is ax+b. I have created the encryption function. However, I am not sure how to create a decryption function because the inverse of the affine transform ((y-b)/x) won't work because there is division involved. I have seen the wikipedia page on affine encryption/decryption however I do not understand the decryption section. Could someone explain this to me and perhaps give a little pseudo-code to show me how i might go about creating a decryption function?

Thanks