#include "stdio.h"
#include "dos.h"
#include "conio.h"
#include "graphics.h"
void object(int,int,int);
void bubble(int);
void flow(int,int);
void mixing(int,int);
int el[10];
void main()
{
int n,i,d=0,m=0;
clrscr();
printf("Enter the No of Elements : " );
scanf("%d",&n);
for(i=0;iel[j+1])
{
flow(i,j+1);
temp=el[i];
el[i]=el[j+1];
el[j+1]=temp;
}
}
void object(int x,int y,int no)
{
char s[8];
sprintf(s,"%d",no);
circle(x,y,15);
settextstyle(2,0,6);
outtextxy(x-3,y-10,s);
}
void flow(int f,int s)
{
int i;
for(i=0;i<50;i++) i="0;i<50;i++)" i="50;i">0;i--)
{
setcolor(WHITE);
object(100+f*50,150+i*4,el[s]);
delay(10);
setcolor(0);
object(100+f*50,150+i*4,el[s]);
}
setcolor(WHITE);
object(100+f*50,150+i*4,el[s]);
for(i=50;i>0;i--)
{
setcolor(WHITE);
object(100+s*50,150+i*4,el[f]);
delay(15);
setcolor(0);
object(100+s*50,150+i*4,el[f]);
}
setcolor(WHITE);
object(100+s*50,150+i*4,el[f]);
}
void mixing(int f,int s)
{
int i;
for(i=0;i<(s-f)*50;i++)
{
setcolor(WHITE);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
delay(20);
setcolor(0);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
} setcolor(WHITE);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
}
#include "dos.h"
#include "conio.h"
#include "graphics.h"
void object(int,int,int);
void bubble(int);
void flow(int,int);
void mixing(int,int);
int el[10];
void main()
{
int n,i,d=0,m=0;
clrscr();
printf("Enter the No of Elements : " );
scanf("%d",&n);
for(i=0;i
el[i]=el[j+1];
el[j+1]=temp;
{
setcolor(WHITE);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
delay(20);
setcolor(0);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
} setcolor(WHITE);
object(100+f*50+i,350,el[f]);
object(100+s*50-i,350,el[s]);
}
No comments:
Post a Comment