Infinite loop problem

This is a discussion on Infinite loop problem within the C++ Programming forums, part of the General Programming Boards category; Hi all!
This program seems to get stuck in an infinite loop anytime someone enters an octal number and then ...

Infinite loop problem

Hi all!

This program seems to get stuck in an infinite loop anytime someone enters an octal number and then tries to display it as a a hexadecimal one... I've been scratching my head for hours-- could anyone give me a hand in figuring out why this is happening?

8 is not an octal digit. You are leaving the input stream in octal mode, thus when you encounter an 8, the stream refuses to read it, and sets failbit. You never check the status of your stream so you spin forever, demanding the octal value of the single digit 8.