Using a Loop to Loop Through the Array - C++ Data Type

C++ examples for Data Type:Array

Description

Using a Loop to Loop Through the Array

Demo Code

#include <iostream>

using namespace std;

int main()/* www. java 2 s.  c o  m*/
{
    int myArray[5];

    for (int i=0; i<5; i++)
    {
        myArray[i] = i * 2;
        cout << myArray[i] << endl;
    }

    return 0;
}

Result


Related Tutorials