xFactorSchool.com
Python
JavaScript
How to Do Examples
C Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
JavaScript Code Editor
Practice how to loop through a vector array using for loop in C++
C++ Online Editor
Execute Code
More C++ Sample Code
#include <iostream> #include <string> #include <vector> //vector is a dynamic array using namespace std; // use std namespace to avoid std:: before cout int main() { cout << "for loop begins." << endl; // declare a vector array vector<string> fruits = { "apple", "banana", "cherry", "mango", "orange" }; // loop through the vector for (const string &fruit : fruits) { cout << fruit << endl; } cout << "for loop stopped." << endl; return 0; }