write a program to store and display 10 numbers in an array

10 numbers are first stored in array and then the array is displayed.
This should be your first array program.

Select To use this code as it is.. select and copy paste this code into code.cpp file :)



  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int ar[10];
  7. cout<<"Enter array element: "<<endl;
  8. for(int i=0;i<10;i++)
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. {
  12. cout<<"Enter element "<<i<<": ";
  13. cin>>ar[i];
  14. }
  15. cout<<"Elements of array: "<<endl;
  16. for(i=0;i<10;i++)
  17. cout<<"Element at index number "<<i<<" is: "<<ar[i]<<endl;
  18. getch();
  19. }

Check out this stream