xFactorSchool.com(Beta)
How to Do 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 Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
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; }