for in loops c++ code example
Example 1: for loop in c++
for ( int i = 0; i < 5; i++)
{
cout << "Hello" << endl;
}
// prints hello 5 times.
Example 2: for loop in c++
for (int i = 0; i < 10; i++)
{
cout << i << endl;
}
for ( int i = 0; i < 5; i++)
{
cout << "Hello" << endl;
}
// prints hello 5 times.
for (int i = 0; i < 10; i++)
{
cout << i << endl;
}