Program to illustrates processing of an Array


#include<iostream.h>
#include<conio.h>
void main( )
{
    double A[3];             // Array Declaration
    // Stores Data in Array
    clrscr();
    A[2] = 22.22;
    A[0] = 11.11;
    A[1] = 33.33;
    //Read Data from an Array
    cout << " A[0] = "<<A[0]<<endl;
    cout << " A[1] = "<<A[1]<<endl;
    cout << " A[2] = "<<A[2]<<endl;
    getch( );
}
-------------------------------------------

/* Program to illustrates processing of an Array */
#include<iostream.h>
#include<conio.h>
void main( )
{
    const int SIZE = 5;  //defines the size N for 5 elements
    int A[SIZE] ;      // declares the array's elements as type integer
    cout<<"\n Enter "<<SIZE<<" Numbers : \t" ;
    for ( int i = 0; i < SIZE; i++)
        cin>>A[i];
    cout<<"\n In Reverse Order  : ";
    for( i = SIZE - 1; i >= 0 ; i--)
          cout<<"\t"<<A[i];
                     getch( );
}







0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|