C++ Program To Display Result Stored In An Array





This program takes ‘n’ number as input , stores it in a one dimensional array and displays the content of that array into the screen. This is a basic program using for loop and array.

Firstly, the program will ask for the number of arrays and stores it in the integer ‘n’.

Secondly, it will ask user to insert the elements of array. And lastly it displays the result stored in one dimensional array.

#include<iostream.h>

#include<conio.h>

Void main ()

{

Int a [100];

Int i, n;

Cout<<”\n How many numbers are in the array?”;

Cin>>n;

cout<<”\Enter the elements:”;

For (i=0; i<n; i++)

{

Cin>>a[i];

}

Cout<<”\n contents of the array:”;

For (i=0; i<n; i++)

{

cout<<”\t”<<a[i];

}

getch ();

}



Related posts:

  1. Arrays In C++ Arrays in C++ Array is a collection of similar type...
  2. Array Of Class Object Array of class objects Array is a collection of similar...
  3. Passing Arrays To Functions Passing arrays to functions Array can be passed as argument...
  4. Array of class objects Array of class objects and single inheritance A program consisting...
  5. Array of structure Array of structure It is well known that array is...