资源描述:
《模拟电子琴软件-C语言》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#include#include#definestage=8100intfrq[3][7]={262,294,330,349,392,440,494,524,587,659,698,784,880,988,1024,1174,1318,1396,1568,1760,1976};intmx,my,x,y,step=16;inti=0,j=0;charkey=0;intyun,pr
2、eyun;voidbeginning(){intdriver=DETECT,mode;initgraph(&driver,&mode,"");setcolor(6);settextstyle(1,0,2);outtextxy(x+100,y+40,"Welcometomy");setcolor(4);settextstyle(1,0,0);outtextxy(x+100,y+100,"COMPUTERPIANO");setcolor(3);settextstyle(1,0,3);outtextxy(x+100,y+1
3、30,"Pressanykeytocontinue...");getch();cleardevice();}voiddisp_piano(){intdriver=DETECT,mode;inti,j;initgraph(&driver,&mode,"");x=mx-(21*step)/2;y=my-20;setcolor(3);rectangle(x,y,x+21*step+1,y+100);rectangle(x-1,y-1,x+21*step+2,y+101);setcolor(15);rectangle(x+2
4、,y+50,x+21*step-1,y+98);setfillstyle(1,15);floodfill(x+10,y+60,15);setcolor(0);for(i=x+step;i5、);rectangle(x-41,y-22,x-40,y-53);rectangle(x+21*step+40,y-22,x+21*step+41,y-53);rectangle(x-1,y-93,x+21*step+1,y-92);arc(x-1,y-53,90,180,40);arc(x-1,y-53,90,180,39);arc(x+21*step+1,y-53,0,90,40);arc(x+21*step+1,y-53,0,90,39);rectangle(x+43,y-80,x+21*step-43,y-3
6、5);for(i=x+49;i7、ircle(x+21*step-5,y-70,6);circle(x+21*step-5,y-45,6);setfillstyle(1,4);floodfill(x+21*step-5,y-70,11);floodfill(x+21*step-5,y-45,11);outtextxy(x-30,y-65,"VOLUME");setcolor(3);outtextxy(x+110,y+112,"COMPUTERPIANO");setcolor(10);settextstyle(2,0,5);outtextxy(x-15
8、,y+140,"Help:Esctoquit.");}voidpress_line(inti,intj,intcolor1,intcolor2){intdt;dt=(i*7+j)*step;setcolor(color1);if((i!=0)
9、
10、(j!=0))line(x+1+dt,y+50,x+1+dt,y+98);line(x+2+dt,y