looping through an array in 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: array and for loop in c++
//inserting array elements in cpp
#include<iostream>
using namespace std;
int main()
{
int arr[100];//you can give any data type and any array size you want
for(int i=0;i<100;i++)
{
cin>>arr[i];
}
return 0;
}