How to Make an Infinite For Loop in C++

For loop becomes infinite loop when all the condition in the loop are true and there is no false condition. There are many ways to make a loop infinite but the most simple is to leave the conditional area empty. The Compiler assumes that all these conditions are true and the loop becomes infinite. To stop an infinite loop just press Ctrl+C.

Source Code

#include <iostream>
using namespace std;
int main ()
{
   for( ; ; )
   {
      cout<<" LEP C++ Tutorials For Beginners \n";
   }
}

Output of the Program

Infinite For Loop



Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment