Admin Psy¢h0
:[]:Warning Level:[]: :
Posts : 64 Points : 2147483642 Reputation : 17983 Join date : 2010-01-13
| Subject: Code for Ascending Order Array Fri Feb 05, 2010 7:35 pm | |
| Code for Ascending Order Array!
- Code:
-
#include <iostream.h> #include <conio.h>
void main() { clrscr(); int array[10],t,x; cout << "Enter Integer No. "<< endl; { for(int x=0;x<10;x++) cin>>array[x]; } 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<<"\n\t\t\t\t"<< array[x]; getch(); } |
|