Use a for statement to print the elements of 'values' using array subscript notation - C++ Data Type

C++ examples for Data Type:Array Pointer

Description

Use a for statement to print the elements of 'values' using array subscript notation

Demo Code

#include <iomanip>
#include <iostream>

int main(int argc, const char *argv[]) {
    const int SIZE = 5;

    unsigned int values[SIZE] = {2, 4, 6, 8, 10};

    for (int i = 0; i < SIZE; ++i) {
        std::cout << std::setw(4) << values[i];
    }/*from  www .j  a  v  a2  s  . c  o  m*/

}

Result


Related Tutorials