Do While Loop in C++ programming will execute the code block once, before checking if the condition is true, and repeat a specific block of code until the condition is met.
do
{
this;
and this;
and this;
and this;
}
while(this condition is true);
#include<iostream.h>
#include<conio.h>
void main()
{
int a = 0;
do //doing then Statement.
{
cout<<a<<endl;
a++; //adding 1 to 'a'.
}
while(a <= 10); //loop looping from 0 to 10.
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
int val;
do //executing process.
{
cout<<"Please Enter Password: ";
cin>>val; //user enter value storing in 'val'.
}
while(val != 54265); //loop stops when 'val' value Equal to 54265.
cout<<"Password Correct!";
getch();
}