===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,x,n;
char a[80],c;
cprintf("Enter Word to Arrange: ");
gets(a);
gotoxy(24,1);
for(i=0;a[i+1]!='\0';i++)
{
for(j=0,x=24;a[j+1+i]!='\0';j++,x++)
{
gotoxy(x,1);
textbackground(3);
cprintf("%c",a[j]);
gotoxy(x+1,1);
textbackground(2);
cprintf("%c",a[j+1]);
if(a[j]>a[j+1])
{
c=a[j];
a[j]=a[j+1];
a[j+1]=c;
}
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
gotoxy(x,1);
textbackground(0);
cprintf("%c",a[j]);
gotoxy(x+1,1);
textbackground(0);
cprintf("%c",a[j+1]);
}
}
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,x,n;
char a[80],c;
cprintf("Enter Word to Arrange: ");
gets(a);
gotoxy(24,1);
for(i=0;a[i+1]!='\0';i++)
{
for(j=0,x=24;a[j+1+i]!='\0';j++,x++)
{
gotoxy(x,1);
textbackground(3);
cprintf("%c",a[j]);
gotoxy(x+1,1);
textbackground(2);
cprintf("%c",a[j+1]);
if(a[j]>a[j+1])
{
c=a[j];
a[j]=a[j+1];
a[j+1]=c;
}
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
gotoxy(x,1);
textbackground(0);
cprintf("%c",a[j]);
gotoxy(x+1,1);
textbackground(0);
cprintf("%c",a[j+1]);
}
}
getch();
}
===========================================================================
No comments:
Post a Comment