C++ Flow of Control

  C++

the while loop

It repeatedly executes a section of code as long as the given condition is true

int sum=0, val=1;
while (val <= 10)
{
    sum += val;
    ++val;
}

the for loop

int sum=0;
for (int val=1;val,=10;++val)
{
    sum += val;
}

the if statement

if (val == currVal)
{
    ++cnt;
}