Hello
Can you access only a specific element in a for each loop?
For example how would I print only the second element in the Names array?
Code:#include <windows.h>
#include <array>
#include <iostream>
using namespace std;
int main()
{
std::array<std::string, 3> Names = {"Harry ", "Dick", "Tom"};
for (auto& name : Names)
{
cout << name << '\n';
}
return 0;
}