Upcoming SlideShare
×

# VECTOR ASCENDENTE

572 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
572
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
0
0
Likes
0
Embeds 0
No embeds

No notes for slide

### VECTOR ASCENDENTE

1. 1. ____________________________________________________________________________________________________________________program VectorAscendente;uses crt;varvec:array[1..14]of integer;j,i,aux,n:integer;begintextbackground(4);textcolor(2);clrscr;gotoxy(3,2);writeln(PROGRAMA VECTORES: METODO BURBUJA.);gotoxy(3,4);writeln(Este programa permite almacenar 13 numeros y ordenarlos de formaascendente.);gotoxy(3,6);write(Cuantos datos desea almacenar: );read(n);while (n<1) or (n>13) dobegingotoxy(3,8);write(Rango del numero no permitido);gotoxy(3,9);write(Ingrese de nuevo el numero de datos a almacenar: );clreol;read(n);end;clrscr;j:=-2;for i:=1 to n dobeginj:=j+6;
2. 2. gotoxy(j,2);read(vec[i]);end;for i:=1 to n-1 dobeginfor j:=i+1 to n dobeginif vec[i]>vec[j] thenbeginaux:=vec[i];vec[i]:=vec[j];vec[j]:=aux;end;end;end;j:=-2;for i:=1 to n dobeginj:=j+6;gotoxy(j,4);textcolor(yellow);write(vec[i]);end;readkey;end.____________________________________________________________________________________________________________________
3. 3. ____________________________________________________________________________________________________________________program VectorMetodoBurbuja;uses crt;varvec:array[1..13]of integer;j,i,aux,n:integer;begintextbackground(4);textcolor(2);clrscr;gotoxy(3,2);writeln(PROGRAMA VECTORES: METODO BURBUJA.);gotoxy(3,4);writeln(Este programa permite almacenar 13 numeros y ordenarlos de formaascendente.);gotoxy(3,6);write(Cuantos datos desea almacenar: );read(n);textcolor(yellow);j:=-2;for i:=1 to n dobeginj:=j+6;gotoxy(j,8);read(vec[i]);end;for i:=1 to n-1 dobeginfor j:=i+1 to n dobeginif vec[i]>vec[j] thenbegin
4. 4. aux:=vec[i];vec[i]:=vec[j];vec[j]:=aux;end;end;end;j:=-2;for i:=1 to n dobeginj:=j+6;gotoxy(j,10);write(vec[i]);end;readkey;end.____________________________________________________________________________________________________________________