Showing posts with label how to fill and display array using functions. Show all posts
Showing posts with label how to fill and display array using functions. Show all posts

Wednesday, 25 July 2012

how to fill and display array using functions

This is the source code of how to fill and display array using functions
                                               
#include<iostream.h>
#include<conio.h>

const int n=9;
int GA[n];


void fillarray(void){
    const int n=9;
    int A[n];
   
    int i=0;
    while(i<=9){
       
        cout<<"value of element"<<i<<"?"<<endl;
        cin>>A[i];
       
        GA[i]=A[i];
        i++;
       
   
    }
   

}


void displayarray(void){

  for(int i=0;i<=9;i++){
     cout<<GA[i]<<endl;
      }   
  }
 



int main()
{
    fillarray();
    displayarray();
    getch();
   
}
End