array and for loop in c++ code example
Example 1: for loop with array c++
int v[] = {1,2,3,4,5};
for (int n : v)
cout << n << endl;
//make sure to compile with -std=c++11
Example 2: array and for loop in c++
//inserting array elements in cpp
#include
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;
}