The only problem I see at the moment is there is no explanation of any of the code. What is wrong with how you are asking for help? In other words could you please tell us what you have tried to reach a solution? Could you tell us what you think may be wrong? Could you tell us more about when you started noticing a problem or where the problem might be? Could you at least give enough information so that other users can ask you questions that could lead to a solution? At the moment it does not look like you did not try very much to find a solution, which is not very motivating to someone who is trying to help.
So even without the explanation, I happen to be in a good mood. So I did some work on it anyways. I went to ideone to find out if anything was wrong with the code: http://ideone.com/cvSx7N
It appears to run, but has logical errors on how the polynomial is displayed. I would recommend outputting the polynomial a and b, before they are added. This would be to make sure the input works correctly. Let me know how that goes, and I will keep heling you if you have any other problems.