Contact: aviboots(AT)netvision.net.il
39,855 questions
51,776 answers
573 users
#include <iostream> int main() { int arr[] = {1, 2, 3, 4, 5, 6}; for (int n : arr) { std::cout << n << " "; } } /* run: 1 2 3 4 5 6 */
#include <iostream> #include <array> int main() { std::array<std::string, 4> arr = {"c", "c++", "python", "java"}; for (const std::string& str : arr) { std::cout << str << " "; } } /* run: c c++ python java */
#include <iostream> #include <vector> int main() { std::vector<std::string> vec{"c", "c++", "python", "java", "c#"}; for (auto str: vec) { std::cout << str << " "; } } /* run: c c++ python java c# */