Created
January 24, 2015 06:41
-
-
Save GurjotSinghMahi/d194a1b70c8326984538 to your computer and use it in GitHub Desktop.
C++ demonstration of Array Traversing Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int arr[20],range,n; | |
cout<<"enter the range of elements"<<endl; | |
cin>>range; //input the range of items to be inserted | |
cout<<"enter the array"<<endl; | |
for(n=0;n<range;n++) | |
cin>>arr[n]; //input the item in array | |
for(int c=0;c<range;c++) //performs traversing | |
cout<<"you have entered "<<arr[c]<<" at "<<c+1<<" position"<<endl; //output the result | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment