Hello,

Problem lies not in the code you have shown but somewhere else, I feel. The code modified from what you have shown

Code:
do
{
	cout << "I am stuck in an infinite loop" << endl;
	Sleep(5000);
}
while (1 == 1);
prints the complaint I am stuck in an infinite loop every 5 seconds till I close the program manually.

Just being curious: Why did you design it as an infinite loop?

Regards,
Pravin.