I am interested in your matter. Now I am stuck with my assignments. I will send a corrected version as the reply tomorrow. With a rough look I saw that the loop condition
while((a != ans) && (count < 2)) should be corrected to
while((a != ans) && (count < 3)). Starting the counter from 1 will also avoide conflicts unless you are familiyar with the concepts of programming. As a suggestion you should use a for loop so the conflicts are minimum. As a matter of style, I think you should use a bool type value to check the condition. To keep portability, do not use void as the return type of main().
_________________________
Hacking is an art that is to be mastered to get the rewards from it!
----Virtual Ranger - VR----