(a)
Queue<double>^ q = gcnew Queue<double>; for (int i = 1; i <= 5; ++i) q->Enqueue(i * 2.5); for each (double d in q) Console::Write(" {0}", d); Console::WriteLine(); array<int>^ values = {4, 6, 7, 9, 2}; for each (int value in values) Console::Write(" {0}", value); Console::WriteLine();(b)
2.5 5 7.5 10 12.5 4 6 7 9 2
Example 10: C++/CLI for each statement.