鼠标操作

  1 #include<stdio.h>
  2 #include<string.h>
  3 #include<stdlib.h>
  4 #include<graphics.h>
  5 #include<conio.h>
  6 #include<math.h>
  7 #include<dos.h>
  8 #define S 16
  9 #define HZK "c:\hzk16"
 10 long app=0,opple=0,Akm=0,sdibt=0;
 11 int x=60,y=80;
 12 char app1[123];
 13 void newxy();
 14 void cursor();
 15 void dispz();
 16 void my_sound();
 17 void load_pic();
 18 void save_pic();
 19 void input();
 20 void read_date();
 21 long Mouse_operate();
 22 void disphz();
 23 int oi=0;
 24 struct HEAD
 25 {
 26     char  file_type;
 27     char  file_date[3];
 28     long   file_num;
 29     short file_width;
 30     short rec_width;
 31 } head;
 32 struct file
 33 {
 34     char field_name[10];
 35     char field_type[2];
 36     long  field_start;
 37     char field_width;
 38     char field_dight;
 39 } Fild;
 40 struct ranklist
 41 {
 42     char name[123];
 43     double english;
 44     double math;
 45     double    sum;
 46     double computer;
 47 } p;
 48 union input
 49 {
 50     int key;
 51     char cmp[2];
 52 } key;
 53 int  cmp(const void *a,const void *b)
 54 {
 55     struct ranklist *c=(struct ranklist *)a;
 56     struct ranklist *d=(struct ranklist *)b;
 57     if(c->sum==d->sum)
 58         return d->english-c->english;
 59     return d->sum-c->sum;
 60 }
 61 void input()
 62 {
 63     int gmode,gdriver=DETECT;
 64     long lenth=0,flag=0,m,k=0;
 65     char str[112],arr[]= {"Please input your secret"},ch;
 66     initgraph(&gdriver,&gmode,"");
 67     cleardevice();
 68     setcolor(4);
 69     setcolor(15);
 70     bar(110,120,310,150);
 71     disphz(110,100,"请输入数据库文件名,回车键结束",15,1);
 72     disphz(110,180,"提示",15,1);
 73     setcolor(15);
 74     outtextxy(142,215,"1.");
 75     disphz(155,210,"可以带盘符和路径,如:",15,1);
 76     setcolor(15);
 77     outtextxy(380,215,"c:\tc\ss.dbf");
 78     setcolor(15);
 79     outtextxy(145,235,"2.dbf");
 80     disphz(185,230,"可省略",15,1);
 81     memset(app1,0,sizeof(app1));
 82     do
 83     {
 84         flag++;
 85         if(flag%2==0)
 86             setcolor(15);
 87         else
 88             setcolor(0);
 89         line(110+lenth*16,150,110+lenth*16+10,150);
 90         delay(200);
 91     }
 92     while(!kbhit());
 93     setcolor(15);
 94     line(110+lenth*16,150,110+lenth*16+10,150);
 95     while(1)
 96     {
 97 
 98         ch=getch();
 99         if(ch!=8&&ch!='
')
100         {
101             str[k++]=ch;
102             str[k]='';
103 
104         }
105         else if(ch==8)
106         {
107             if(k-1>=0)
108             {
109                 str[k-1]='';
110                 k--;
111             }
112         }
113         else
114             break;
115         setcolor(15);
116         settextstyle(0,0,2);
117         outtextxy(110,135,app1);
118         setcolor(0);
119         settextstyle(0,0,2);
120         outtextxy(110,135,str);
121         strcpy(app1,str);
122         setcolor(15);
123         line(110+lenth*16,150,110+lenth*16+10,150);
124         lenth=strlen(str);
125         do
126         {
127             flag++;
128             if(flag%2==0)
129                 setcolor(15);
130             else
131                 setcolor(0);
132             line(110+lenth*16,150,110+lenth*16+10,150);
133             delay(200);
134         }
135         while(!kbhit());
136     }
137     strcpy(app1,str);
138 }
139 void read_date(struct ranklist *student)
140 {
141     long n,i,j,m,p3,cpu;
142     char str[134],kk[123];
143     double score;
144     char ch,name[123];
145     long start1,start2,start3,count=0,p1,p2,p4,start4;
146     FILE *fp;
147     m=app;
148     input();
149     while(1)
150     {
151         if(strlen(app1)>=4&&app1[strlen(app1)-4]!='.')
152         {
153             strcat(app1,".dbf");
154             app1[strlen(app1)]='';
155         }
156         if((fp=fopen(app1,"rb"))==NULL)
157         {
158 
159 
160             setcolor(1);
161             rectangle(270,240,580,370);
162 
163             setfillstyle(1,1);
164             floodfill(273,243,1);
165             setcolor(15);
166             outtextxy(290,300,"1.");
167             disphz(275,245,"打不开文件,请选择以下两种方案",15,1);
168             disphz(310,295,"如果想重新输入请按数字一",15,1);
169             setcolor(15);
170             outtextxy(290,320,"2.");
171             disphz(310,315,"如果想退出请按数字二",15,1);
172             cpu=getch();
173             if(cpu=='1')
174                 input();
175             else
176                 sdibt=2;
177         }
178         else
179             break;
180         if(sdibt==2)
181             return;
182 
183     }
184     fp=fopen(app1,"rb");
185     fread(&head,12,1,fp);
186     fseek(fp,20,1);
187     for(i=0;; i++)
188     {
189         fread(&Fild,18,1,fp);
190         if(strcmp(Fild.field_name,"数学")==0)
191         {
192             start2=Fild.field_start;
193             p1=Fild.field_width;
194             count++;
195         }
196         if(strcmp(Fild.field_name,"姓名")==0)
197         {
198             start1=Fild.field_start;
199             count++;
200             p2=Fild.field_width;
201         }
202         if(strcmp(Fild.field_name,"英语")==0)
203         {
204             start3=Fild.field_start;
205             count++;
206             p3=Fild.field_width;
207         }
208         if(strcmp(Fild.field_name,"计算机")==0)
209         {
210             start4=Fild.field_start;
211             count++;
212             p4=Fild.field_width;
213         }
214         if(count==4)
215             break;
216         fseek(fp,14,1);
217     }
218     fseek(fp,head.file_width,0);
219     for(m=0; m<head.file_num; m++)
220     {
221         fseek(fp,head.file_width+m*head.rec_width,0);
222         ch=fgetc(fp);
223         if(ch=='*')
224             continue;
225         fseek(fp,head.file_width+m*head.rec_width+start1,0);
226         for(j=0; j<p2; j++)
227             name[j]=fgetc(fp);
228         name[j]='';
229 j=0;
230         for(i=0; i<p2; i++)
231         {
232          
233 if(name[i]!=32)
234     kk[j++]=name[i];
235         }
236 kk[j]='';
237         strcpy(student[app].name,kk);
238         score=0;
239         fseek(fp,m*head.rec_width+head.file_width+start2,0);
240         fgets(str,p1,fp);
241         for(i=0; i<strlen(str); i++)
242         {
243             if(str[i]==' ')
244                 continue;
245             if(str[i]!='.'&&str[i-1]!='.')
246                 score+=str[i]-48;
247             if(str[i+1]!='.'&&str[i]!='.'&&str[i-1]!='.')
248                 score*=10;
249             if(str[i-1]=='.')
250             {
251                 score+=(str[i]-48)/10.0;
252                 break;
253             }
254         }
255         student[app].math=score;
256         fseek(fp,m*head.rec_width+head.file_width+start3,0);
257         fgets(str,p3,fp);
258         score=0;
259         for(i=0; i<strlen(str); i++)
260         {
261             if(str[i]==' ')
262                 continue;
263             if(str[i]!='.'&&str[i-1]!='.')
264                 score+=str[i]-48;
265             if(str[i+1]!='.'&&str[i]!='.'&&str[i-1]!='.')
266                 score*=10;
267             if(str[i-1]=='.')
268             {
269                 score+=(str[i]-48)/10.0;
270                 break;
271             }
272         }
273         student[app].english=score;
274         fseek(fp,m*head.rec_width+head.file_width+start4,0);
275         fgets(str,p4,fp);
276         score=0;
277         for(i=0; i<strlen(str); i++)
278         {
279             if(str[i]==' ')
280                 continue;
281             if(str[i]!='.'&&str[i-1]!='.')
282                 score+=str[i]-48;
283             if(str[i+1]!='.'&&str[i]!='.'&&str[i-1]!='.')
284                 score*=10;
285             if(str[i-1]=='.')
286             {
287                 score+=(str[i]-48)/10.0;
288                 break;
289             }
290         }
291         student[app].computer=score;
292         student[app].sum=student[app].english+student[app].math+student[app].computer;
293         fseek(fp,head.file_width+m*head.rec_width,0);
294         app++;
295     }
296     qsort(student,app,sizeof(student[0]),cmp);
297     for(i=0; i<app; i++)
298         printf("%s %.2lf %.2lf %.2lf %.2lf
",student[i].name,student[i].english,student[i].math,student[i].computer,student
299 
300                [i].sum);
301     fclose(fp);
302 }
303 long Mouse_operate(long kk,long m)
304 {
305     int buttons,sum=0;
306     char str[100];
307     setwritemode(XOR_PUT);
308 
309     if(Akm==0)
310     {
311         init(2,638,8,477);
312         x=320;
313         y=240;
314     }
315     Akm=2;
316     cursor(x,y);
317     for(;;)
318     {
319         newxy(&x,&y,&buttons);
320         if(kbhit())
321         {
322             opple++;
323             return kk;
324         }
325         if(x>=100&&x<=150&&y>=435&&y<=455&&buttons&&m)
326         {
327             if(kk-3>=0)
328                 return kk-3;
329             return kk;
330         }
331         else if(x>=260&&x<=310&&y>=435&&y<=455&&buttons&&m)
332         {
333 
334             if(kk+3<m)
335                 return kk+3;
336             return kk;
337         }
338         else if(x>=420&&x<=470&&y>=435&&y<=455&&buttons&&m)
339         {
340 
341             return -1;
342         }
343         else if(x>=285&&x<=330&&y>=435&&y<=455&&buttons&&m==0)
344             return -1;
345 
346     }
347 
348 }
349 int init(int xmin,int xmax,int ymin,int ymax)
350 {
351     union REGS regs;
352     regs.x.ax=0;
353     int86(51,&regs,&regs);
354     if(regs.x.ax==0)
355         return 0;
356     regs.x.ax=7;
357     regs.x.cx=xmin;
358     regs.x.dx=xmax;
359     int86(51,&regs,&regs);
360     regs.x.ax=8;
361     regs.x.cx=ymin;
362     regs.x.dx=ymax;
363     int86(51,&regs,&regs);
364     return -1;
365 }
366 int read_mouse(int *mx,int *my,int *mbutton)
367 {
368     union REGS regs;
369     int x0=*mx,y0=*my,button0=*mbutton;
370     int xnew,ynew;
371     do
372     {
373         regs.x.ax=3;
374         int86(0x33,&regs,&regs);
375         xnew=regs.x.cx;
376         ynew=regs.x.dx;
377         *mbutton=regs.x.bx;
378     }
379     while(xnew==0&&ynew==y0&&*mbutton==button0);
380     *mx=xnew;
381     *my=ynew;
382     switch(*mbutton)
383     {
384     case 0:
385         return 0;
386     case 1:
387         return 1;
388     case 2:
389         return 2;
390     case 3:
391         return 3;
392     default :
393         return 4;
394     }
395 }
396 void newxy(int *mx,int *my,int *mbutt)
397 {
398     int ch,xx0=*mx,yy0=*my;
399     int xm,ym;
400     ch=read_mouse(&xm,&ym,mbutt);
401     cursor(xx0,yy0);
402     cursor(xm,ym);
403     *mx=xm;
404     *my=ym;
405 
406 }
407 void cursor(int x,int y)
408 {
409     int x1,x2,y1,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8;
410     x1=x-15;
411     y1=y+15;
412 
413     line(x,y,x1,y1);
414     x2=x1+5;
415     y2=y1+10;
416     line(x1,y1,x2,y2);
417     x3=x-2;
418     y3=y+15;
419     line(x2,y2,x3,y3);
420     x4=x-2;
421     y4=y+35;
422     line(x3,y3,x4,y4);
423    x5=x+15;
424    y5=y+15;
425    line(x,y,x5,y5);
426    x6=x5-5;
427    y6=y5+10;
428    line(x5,y5,x6,y6);
429    x7=x+2;
430    y7=y+15;
431    line(x6,y6,x7,y7);
432     x8=x7;
433     y8=y+35;
434    line(x7,y7,x8,y8);
435    line(x4,y4,x8,y8);
436    }
437 
438 void picture(struct ranklist b[])
439 {
440     int i,j,gmode,gdriver=DETECT,q,kmp,a[3]= {9,8,6},k=30,pos[10];
441     long m,kk=0,l=6,n=0,cmp,num=0,flag=0,mmk;
442     char arr;
443     char page[][77]= {"(F)","(B)","(Esc)"};
444     char str[22][22]= {"10","20","30","40","50","60","70","80","90","100"},dis[3][100]= {"前页","后页","退出"};
445     m=app;
446     initgraph(&gdriver,&gmode,"");
447     key.cmp[1]=2;
448     while(1)
449     {
450 
451         if(key.cmp[1]==1)
452             break;
453         k=50;
454         q=10;
455         l=6;
456 
457         line(25,10,25,405);
458         line(20,15,25,10);
459         line(30,15,25,10);
460         line(25,403,550,403);
461         line(540,399,550,403);
462         line(540,407,550,403);
463         outtextxy(15,15,"y");
464         outtextxy(15,400,"o");
465         outtextxy(560,400,"x");
466         disphz(80,15,"学生成绩柱状图分布",4,2);
467         for(i=0; i<=9; i++)
468         {
469             line(25,400-q*3,30,400-q*3);
470             outtextxy(0,400-q*3,str[i]);
471             q+=10;
472         }
473         kmp=0;
474         for(i=0; i<3; i++)
475         {
476             setfillstyle(1,a[i]);
477             bar(540,kmp,575,30+kmp);
478             if(i==0)
479                 disphz(575,10+kmp,"英语",4,1);
480             if(i==1)
481                 disphz(575,10+kmp,"数学",4,1);
482             if(i==2)
483                 disphz(575,10+kmp,"计算机",4,1);
484             kmp+=50;
485 
486         }
487         flag++;
488         for(i=0; i<3; i++)
489         {
490             if(i+kk>=m)
491                 break;
492 
493             disphz(k+60,405,b[i+kk].name,4,1);
494             for(j=0; j<3; j++)
495             {
496                 if(j==0)
497                 {
498                     setfillstyle(1,9);
499                     bar3d(k,400-b[i+kk].english*3,k+50,400,35,1);
500 
501                 }
502                 else if(j==1)
503                 {
504                     setfillstyle(1,8);
505                     bar3d(k,400-b[i+kk].math*3,k+50,400,35,1);
506                     if(flag==1)
507                     {
508                         pos[num]=k;
509                         num++;
510                     }
511                 }
512                 else
513                 {
514                     setfillstyle(1,6);
515                     bar3d(k,400-b[i+kk].computer*3,k+50,400,35,1);
516                 }
517                 k+=50;
518 
519             }
520             k+=10;
521         }
522         pos[num]='';
523         for(cmp=0; cmp<3; cmp++)
524         {
525             setfillstyle(1,4);
526         if((kk==0&&cmp==0)||(cmp==1&&(kk==app-2)))
527                 setfillstyle(1,8);
528             bar3d(pos[cmp],435,pos[cmp]+65,455,12,1);
529             disphz(pos[cmp],437,dis[cmp],0,1);
530             outtextxy(pos[cmp]+39,440,page[cmp]);
531         }
532         opple=0;mmk=kk;
533         kk=Mouse_operate(kk,m);
534         if(kk==-1||key.cmp[1]==1)
535             break;
536         n=3;
537 
538         while(n--)
539         {
540             delay(50000);
541         }
542         if(opple==1)
543             kk=keyboard(kk,m)  ;
544 if(mmk!=kk)
545         cleardevice();
546 
547     }
548 }
549 int keyboard(long kk,long  m)
550 {
551     key.key=bioskey(0);
552     if(key.cmp[0]=='F')
553     {
554         if(kk-3>=0)
555             return kk-3;
556         return kk;
557     }
558     else if(key.cmp[0]=='B')
559     {
560         if(kk+3<m)
561             return kk+3;
562         return kk;
563     }
564     return kk;
565 
566 }
567 void graph(struct ranklist *b)
568 {
569     int gmode,gdriver=DETECT,i,kmp,j,flag,p=0,kkp,hhh;
570     long kk[7]= {0},start=0,l=2,kkk=2,m=0,k=30;
571   int hh[12],s=0,s2=0;
572     char name[123][123];
573     initgraph(&gdriver,&gmode,"");
574     cleardevice();
575     disphz(28,15,"学生成绩饼状图分布",4,2);
576     for(i=0; i<app; i++)
577     {
578         if(b[i].sum/3<=60)
579             kk[0]++;
580         else if(b[i].sum/3<=70)
581             kk[1]++;
582         else if(b[i].sum/3<=80)
583             kk[2]++;
584         else if(b[i].sum/3<=90)
585             kk[3]++;
586         else
587             kk[4]++;
588     }
589     kmp=0;
590  
591     for(i=0; i<5; i++)
592     {
593         if(i==4)
594             hh[i]=(1-s)*10000;
595 hh[i]=10000*kk[i]*1.0/app;
596         s+=hh[i];
597         setfillstyle(1,kkk++);
598         bar(470,kmp,505,30+kmp);
599         if(i==0)
600             outtextxy(505,10+kmp,"0--60");
601         if(i==1)
602             outtextxy(505,10+kmp,"60--70");
603         if(i==2)
604             outtextxy(505,10+kmp,"70--80");
605         if(i==3)
606             outtextxy(505,10+kmp,"80--90");
607         if(i==4)
608             outtextxy(505,10+kmp,"90--100");
609         kmp+=40;
610 
611     }
612   for(i=0;i<5;i++){  
613     j=0;
614 flag=0;hhh=1;
615 p=hh[i];kkp=p;
616 printf("%d
",p);
617 getch();
618  while(p)
619     {
620 
621         if(p>0)
622             flag++;
623         p/=10;
624         hhh*=10;
625 
626     }
627     hhh/=10;
628 p=kkp; name[i][flag-2]='.';}
629     
630       /* while(hhh)
631         {
632             if(name[i][j]=='.')
633             {
634                 j++;
635             }
636             name[i][j++]=p/hhh;
637             hhh/=10;
638             p/=10;
639         }
640     
641 name[i][j]='';
642 puts(name[i]);
643 getch();
644 }*/
645     for(i=0; i<5; i++)
646     {
647 
648         setfillstyle(1,l++);
649         if(i==4)
650             pieslice(360,240,start,360,100);
651         else
652             pieslice(360,240,start,start+kk[i]*360/app,100);
653         start+=kk[i]*360/app;
654 s=start;
655   s2=100*sin(s/2);
656    
657       
658     }
659     setfillstyle(1,4);
660     bar3d(280,435,330,455,12,1);
661     outtextxy(285,440,"Esc");
662     k=Mouse_operate(k,m);
663     if(k==-1)
664         return;
665     getch();
666     cleardevice();
667 }
668 void disphz(int x,int y,char *p,int color,int m)
669 {
670     int i,j,n,k;
671     FILE *fp;
672     char qh,wh;
673     long offset;
674     char buffer[S*S/8];
675     char mask[]= {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
676     if((fp=fopen(HZK,"rb"))==NULL)
677         exit(0);
678     while(*p!='')
679     {
680         qh=*p-0xa0;
681         p++;
682         wh=*p-0xa0;
683         p++;
684         offset=(94L*(qh-1)+wh-1)*S*S/8;
685         fseek(fp,offset,0);
686         fread(buffer,S*S/8,1,fp);
687         for(i=0; i<S; i++)
688         {
689             for(j=0; j<S; j++)
690             {
691                 if((buffer[S/8*i+j/8]&mask[j%8])!=0)
692                     for(n=0; n<m; n++)
693                         for(k=0; k<m; k++)
694                             putpixel(x+j*m+n,y+i*m+k,color);
695             }
696         }
697         x+=S*m+5;
698     }
699     fclose(fp);
700     return;
701 }
702 void save_pic()
703 {
704   FILE *fp;
705 int i;
706 char far *p;
707 long j;
708 fp=fopen("pic.dat","wb");
709 for(i=0;i<4;i++)
710 {
711  outportb(0x3ce,4);
712   outportb(0x3cf,i);
713 p=(char far*)0xa0000000L;
714 for(j=0;j<38400L;j++)
715 { fputc(*p,fp);
716    p++;
717 }
718 }
719 fclose(fp);
720 outportb(0x3cf,0);
721 }
722 void load_pic(int kk)
723 {
724    FILE *fp;
725 int i,k=1;
726 char far *p;
727 long j;
728 fp=fopen("pic.dat","rb");
729 for(i=0;i<4;i++)
730 {
731    outportb(0x3c4,2);
732 outportb(0x3c5,k);
733 p=(char far*)0xa0000000L-kk*80;
734 for(j=0;j<38400;j++)
735 {
736      *p=getc(fp);
737     p++;
738 }
739 k*=2;
740 }
741 fclose(fp);
742 outportb(0x3c5,0xcf);
743 }
744 
745 void title()
746 {
747     int i,n=0,k=0;
748     int gmode,gdriver=DETECT;
749     char ppq[][111]= {"1:","",""};
750     char str[][123]= {"","","","",""},arr[][111]= {"程序功能","显示学生成绩分布图","显示各分数段圆饼图"};
751 initgraph(&gdriver,&gmode,"");
752     cleardevice();
753     setcolor(15);
754     rectangle(130,180,500,400);
755     setbkcolor(3);
756     outtextxy(170,180,":");
757     settextstyle(1,0,9);
758     outtextxy(70,20,"c");
759     for(i=1; i<=5; i++)
760     {
761         setcolor(1);
762         circle(100+n,80,50);
763         disphz(70+n,46,str[i-1],4,3);
764         if(i<=3)
765         {
766             disphz(170,180+k,arr[i-1],4,1);
767             setcolor(4);
768             if(i>=2)
769                 disphz(145,180+k,ppq[i-1],4,1);
770         }
771         n+=120;
772         k+=30;
773     }
774     disphz(210,320,"按任意键继续",15,2);
775 }
776 void backspace()
777 {
778     settextstyle(1,0,9);
779     setcolor(4);
780     outtextxy(120,120,"The End");
781     getch();
782 }
783 void introduce()
784 {
785     int i,k=0,n=30,p=0,l=5,opp=0,kk=0;
786     char str[][12]= {"","","","","","","","","","","","","","","","","","","","",""};
787     char  arr[][13]= {"","","","","","","","","","","","","","","","","","","","",""};
788 char   bbq[][123]={"","","","","","",""};    
789     cleardevice();
790 
791 
792     for(i=0; i<49; i++)
793     {
794 
795         if(i<21)
796             disphz(220+k,240,str[i],4,1);
797         else if(i>=21&&i<42)
798             disphz(180+opp,260,arr[i%21],4,1),opp+=20;
799         else
800             disphz(320+kk,290,bbq[i-42],4,2),kk+=30;
801         k+=20;
802         my_sound(i+1);
803      
804     }
805 
806     save_pic();
807     for(i=0; i<250; i++)
808     {
809         load_pic(i);
810         cleardevice();
811     }
812     backspace();
813 
814 }
815 void music(unsigned int freq,int times)
816 {
817     int i;
818     union
819     {
820         int divisor;
821         char c[2];
822     } count;
823     char bits;
824     count.divisor=1193180/freq;
825     outportb(0x43,0xb6);
826     outportb(0x42,count.c[0]);
827     outportb(0x42,count.c[1]);
828     bits=inportb(0x61);
829     outportb(0x61,bits|3);
830     for(i=0; i<times; i++)
831         delay(25000);
832     outport(0x61,bits&0xfc);
833     outportb(0x61,bits);
834 }
835 void my_sound(int l)
836 {
837     int freq[8]= {0,256,294,330,349,392,440,494};
838     int song[]= {   8,8,5,5,3,6,5,3,
839                     2,1,2,3,1,0,
840                     3,1,3,3,1,
841                     3,3,5,6,5,0,
842                     6,6,6,5,4,4,4,
843                     2,3,2,1,2,0,
844                     3,1,0,3,1,0,
845                     3,3,5,6,6,0,
846                     8,5,5,6,3,
847                     2,1,2,3,5,5,
848                     8,5,5,6,3,
849                     2,1,2,3,1,1
850 
851 
852                 };
853     float div[]= {  8,8,8,8,8,8,8,8,
854                     8,8,8,8,4,4,
855                     4,4,8,8,4,
856                     8,8,8,8,4,4,
857                     8,8,8,8,8,8,4,
858                     8,8,8,8,4,4,
859                     4,8,8,4,8,8,
860                     8,8,8,8,4,4,
861                     4,8,8,4,4,
862                     8,8,8,8,4,4,
863                     4,8,8,4,4,
864                     8,8,8,8,4,4
865 
866                  };
867     unsigned int f;
868     int times,i;
869     for(i=l; i<l+1; i++)
870     {
871         if(song[i]<0)
872             f=freq[-song[i]]/2;
873         else if(song[i]>7)
874             f=freq[song[i]%7]*2;
875         else if(song[i]==0)
876             f=100000000000000;
877         else
878             f=freq[song[i]];
879         times=16/div[i];
880         music(f,times);
881     }
882     return 0;
883 }
884 
885 int main()
886 {
887     struct ranklist student[123];
888     title();
889     getch();
890     read_date(student);
891     if(sdibt==0)
892     {
893         picture(student);
894         graph(student);
895         introduce();
896     }
897     return 0;
898 }
原文地址:https://www.cnblogs.com/moomcake/p/9007229.html