-
Notifications
You must be signed in to change notification settings - Fork 1
/
SELECT~1.BAK
66 lines (54 loc) · 940 Bytes
/
SELECT~1.BAK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<iostream.h>
#include<dos.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver = EGA, gmode = EGAHI, errorcode;
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
const int sx=getmaxx();
const int sy=getmaxy();
int a[1000];
int dx=100;
setcolor(3);
int n=sx/dx;
for(int i=0;i<n;i++)
{
a[i]=(random(sy)+random(sy))/2;
for(int j=i*dx;j<dx+i*dx;j++)
{
line(j,sy,j,sy-a[i]);
}
}
cout<<n;
getch();
int c=1;int position;
int small=0;
for(i=0;i<n;i++)
{ small=a[i];
position=i;
for(int j=i+1; j<n; j++)
{
if(a[j]<small)
{
small=a[j];
position=j;
a[position]=a[i];
a[i]=small;
}
cleardevice();
clrscr();
for(int k=0;k<n;k++)
{
for(int j=k*dx;j<dx+k*dx;j++)
{
line(j,sy,j,sy-a[k]);
}
}
delay(10);
}
}//outer for
getch();
}