In this post, we will see C++ For Each Loop | Range Based For Loop in C++ | Enhanced For Loop in C++
Program Code: (loopstructure4.cpp)
#include<iostream>
using namespace std;
int main()
{
//int arr[]={20,10,40,50,25};
for(int i: {20,10,40,50,25})
{
cout<<"Value="<<i<<endl;
}
char x[]={'a','b','c','d'};
for(char i:x)
{
cout<<"Character ="<<i<<endl;
}
}
Watch following video:
Watch on YouTube: https://www.youtube.com/watch?v=_NSuwIJG8tw
No comments:
Post a Comment