#include <stdio.h> #include <dos.h> void printbk(char*s,int x,int y); void fish(char*FISH,int Fish_x,int Fish_y,int x,int y); void D_fish(char*FISH,int Fish_x,int Fish_y); int main() { char FISH2[]= " / " " / \\ " "<')_=<" " \\_/ " " \\ " ; char FISH1[]= " \\ " " / \\ " ">=_('>" " \\_/ " " / " ; char BK[]= "~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^^~^~^~^~^~^~" " o ~ o o ~ " " ' o ' " " o o o o " " ' ' ' " " ' ~ " " " " ~ . " " " " " " " " o ) " " ( ( " " ~ ) ) " " ) ~ ( ( ( " " ( ( o o ) ) ) " " o ) ) . ( ( ( " " ( ( /^^^^^^^^^^^^^^^^^^" "^^^^^^^^^^^^^^^^^^\ / " " ^^^^^^^^^ " ; char*FISH=FISH2 ; int key,x=53,y=10 ; int flag=1 ; union REGS regs ; regs.h.ah=1 ; regs.h.ch=13 ; regs.h.cl=0 ; int86(0x10,®s,®s); printbk(BK,13,3); while(1) { fish(FISH,5,6,x,y); if(flag>0)x--; else x++; if(x<15||x>53)flag*=-1,FISH=FISH==FISH1?FISH2:FISH1 ; /*D_fish(FISH,5,6);*/ } } void fish(char*FISH,int Fish_x,int Fish_y,int x,int y) { int i,j ; for(i=0;i<Fish_x;i++) for(j=0;j<Fish_y;j++) { gotoxy(x+j,y+i); if(*(FISH+i*Fish_y+j))putchar(*(FISH+i*Fish_y+j)); } delay(8500); /* sleep(1); */ for(i=0;i<Fish_x;i++) for(j=0;j<Fish_y;j++) { gotoxy(x+j,y+i); if(*(FISH+i*Fish_y+j))putchar(' '); } /*system("cls"); */ } void D_fish(char*FISH,int Fish_x,int Fish_y) { int temp,i,j ; for(i=0;i<Fish_x;i++) for(j=0;j<Fish_y/2;j++) { temp=*(FISH+i*Fish_y+j); *(FISH+i*Fish_y+j)=*(FISH+i*Fish_y+(Fish_y-j-1)); *(FISH+i*Fish_y+(Fish_y-j-1))=temp ; } } void printbk(char*s,int x,int y) { int i,j ; for(i=0;i<20;i++) for(j=0;j<48;j++) { gotoxy(x+j,y+i); if(*(s+i*48+j)!=32)putchar(*(s+i*48+j)); } }
[此贴子已经被作者于2004-11-07 13:32:56编辑过]