Check on loop | Ask user to run / terminate the loop | Loop

# include <iostream>
using namespace std;
void main()
{

int i=1;
char checker='y'; // for first run

while (i>0) // an infintie loop
{
       
                 if (checker=='y' || checker=='Y') // condition check
       {
                 cout<<"Ali\n"; // text which is repeated
                 i++;
      
       cout<<"Press y to continue and n to terminate =";
       cin>>checker; // get value to terminate or continue the loop
       
}

       else
             break; // if y ot Y is not printed then loop autometically break.
}
}


Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System