/*This is the program that simulates
piano an is done with the help of array's
and sound function and use of simple graphic*/
#include <dos.h>
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{ clrscr();
char ch[50];int a=10,b=10,c=10,d=10,e=10,f=10,g=10,h=10;
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
setcolor(RED);
{settextstyle(4,0,3);
outtextxy(120,5," E n t e r t h e t u n e ");
settextstyle(2,0,5);
outtextxy(480,30,"DONE BY:-NAVEEN.M.N");
}
settextstyle(0,0,100);
setbkcolor(CYAN);
for(int i=0;ch[i-1]!='0',i<50;++i)
{ch[i]=getche();
if(ch[i]=='0')
break;
switch(ch[i])
{case '1':outtextxy(a,50," ");
a+=40;
break;
case '2':outtextxy(b,100," ");
b+=40;
break;
case '3':outtextxy(c,150," ");
c+=40;
break;
case '4':outtextxy(d,200," ");
d+=40;
break;
case '5':outtextxy(e,250," ");
e+=40;
break;
case '6':outtextxy(f,300," ");
f+=40;
break;
case '7':outtextxy(g,350," ");
g+=40;
break;
case '8':outtextxy(h,400," ");
h+=40;
break;
}
}
for(int j=0;j<i;++j)
{if(ch[j]=='0')
break;
switch(ch[j])
{case '1':sound(240);
delay(100);
nosound();
continue;
case '2': sound(300);
delay(100);
nosound();
continue;
case '3' : sound(360);
delay(100);
nosound();
continue;
case '4' : sound(420);
delay(100);
nosound();
continue;
case '5' : sound(480);
delay(100);
nosound();
continue;
case '6' : sound(540);
delay(100);
nosound();
continue;
case '7' : sound(600);
delay(100);
nosound();
continue;
case '8' : sound(660);
delay(100);
nosound();
continue;
}
}
closegraph();
}
/*For modification email to "npr123456789@gmail.com"
DONE BY:-NAVEEN.M.N*/
0 comments :