how to iterate through an array c++ code example
Example 1: c++ loop through array
string texts[] = {"Apple", "Banana", "Orange"};
for( unsigned int a = 0; a < sizeof(texts); a = a + 1 )
{
cout << "value of a: " << texts[a] << endl;
}
Example 2: loop through array c++
for(int i = 0; i < 4; i++) {
cout << cars[i] << "\n";
}
Example 3: how to iterate through array in c++
for(int i=0; i<n; i++)
cout<<array[i]<<" "
cout<<endl;