1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// array::at
#include <iostream>
#include <array>
int main ()
{
std::array<int,10> myarray;
// assign some values:
for (int i=0; i<10; i++) myarray.at(i) = i+1;
// print content:
std::cout << "myarray contains:";
for (int i=0; i<10; i++)
std::cout << ' ' << myarray.at(i);
std::cout << '\n';
return 0;
}
| |