Program to enter 10 integers in a single-dimension array and then print out the

Started by aruljothi, Jun 11, 2009, 04:29 PM

Previous topic - Next topic

aruljothi

#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
int array[10],t;
for(int x=0;x<10;x++)
{
cout << "Enter Integer No. " << x+1 << " : " << endl;
cin>>array
  • ;
    }
    for (x=0;x<10;x++)
    {
    for(int y=0;y<9;y++)
    {
    if(array[y]>array[y+1])
    {
    t=array[y];
    array[y]=array[y+1];
    array[y+1]=t;
    }
    }
    }
    cout << "Array in ascending order is : ";
    for (x=0;x<10;x++)
    cout << endl << array
  • ;
    getch();
    }