C++ break with for loop

#include <iostream>
using namespace std;

int main() {
   for (int i = 0; i < 10; i++) {
      cout << i << endl;
      if (i == 5) {
         break;
      }
   }
   return 0;
}
  1. Include input/output stream library.
  2. Use the standard namespace.
  3. Define the main function.
  4. Begin a for loop with an integer variable i initialized to 0, with a condition for i being less than 10, and an increment of i after each iteration.
  5. Print the value of i followed by a new line.
  6. Check if the value of i is equal to 5.
  7. If i is equal to 5, exit the for loop.
  8. Return 0, as the main function is an int type. ```