C++ program to Enter Elements in array of your choice

Enter elements in array

This program show the concept how to enter elements in array

  • Here the entered elements will store in contiguous memory location.
  • The array size must be a integer type and it should be greater than 0.
  • The array element will be accessed through their address.
  • Picture repersentation of program.

Enter elements in array

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x[100],i,a;
cout<<"Enter number of element you want to put in array:- ";
cin>>a;
cout<<"Enter elements in array:-"<<endl;
for(i=0;i<a;i++)
 {
  cin>>x[i];
 }
cout<<"Elements of array are:- "<<endl;
for(i=0;i<a;i++)
{
 cout<<x[i]<<endl;
}
getch();
}

OUTPUT:-

enter elements in array


Comment below if you are facing any problem


Also read

C++ program of defining array
C++ Program to find the Largest element in the array
C++ program to Sort the Entered Element in array
C++ program to print alternate elements from an array
C++ program to Insert an element Into sorted array

Leave a Reply

Your email address will not be published. Required fields are marked *