兄弟们 我又回来了 自从上学以后就一直没机会上网 真的很抱歉 现在特意到论坛来发表一下小东西 前一阵 答应给朋友做一个CAI 的程序 便答应了下来 现在做好了 干脆发上来献丑一下吧本来想加入一个播放音乐的部分 但是时间挺紧 也就没有加 等到以后有时间的话 我会把音乐部分也加近来 其中也许会有一些bug 欢迎大家批评指正 这个是我c语言的最后一个程序了 从这以后我就将告别c语言 开始搞window编程了 愿我能够成功 #include<stdio.h> #include<math.h> #include<dos.h> #include<malloc.h> #include<bios.h> #include<stdlib.h> #include<graphics.h> #include<string.h> #define UP 0x4800 #define DOWN 0x5000 #define ENTER 0x1c0d #define ESC 0x011b #define XMAX 8 #define YMAX 39 #define Y 25 #define YY (19+Y) FILE *f1; int count=0,turn; struct chop { int noun; char name[10]; int speed; }person[10]; char *p[10]={" A high school history teacher once told us,'if you make one close friend in school,you will be most fortunate. A true friend is someone who stays with you for life. 'Experience teaches that he was right ,good friendship are just not easily formed.Why? One reason may relate to the mobility in our society.mr.Darrell Sifford, a news columnist for the <philadelphia inquirer>, has been studying and talking about frienship for a number of years. He reports the thoughts of one woman on this aspect of friendship:'I was nine ,' and we'd just been transferred from South Carolina to new Jersey , and I didn't know anybody." ," The launch was the first time for me on the middeck, inside the space shuttle. There are no windows there and you can not see outside.it surprised me when the shuttle began to roll as part of the launch.All space shuttles do this .But I was used to being on the flight deck where we can see outside through the forward and overhead windows. Up there you can see what is happening ,We soon were in orbit and linked with the International Space station ,Everyone became very busy.Things did not slow down until the shuttle left for the return flight to earth ,there is a limited amount of time to do all of the planned tasks. " ," Our working days slowed a little,but we were still busy. We worked outside the space station two times in January and we had to move cargo? Into the space station from the Russian cargo ship Progress.The Christmas and New Year holidays wewe a nice break from our work.It was very hard for me to be away from my family.We spent most of the holidays catching up on sleep, writing electronic mail and watching movies.We aslo called friends and family on a special telephone linked to the Internet communications system.it was very special to be able to call my family.it was a lot of fun to call someone and listen to their surprise when we asid we were calling from space. " ," To most of us ,frendships rank high in importance, but we need to have clear in our own minds the kinds of friendship we want.Are they to be close and intense or kept at arm's length? Do we want to share ourselves or do we want to walk on the surface?''for some people, many superficial frendships are quite sufficient - and that's all right. But at some point we need to make sure that our expectations are congruent with our friends'expectations.if one wants more from the friendshop than the other.and if this is not talked about ,one is likely eventually to feel that he's holding the short end of the stick." ," What are some of the obstacles to friendships?According to Mr.Sifford,the greatest is the temptation to expect too much too soon. Deep relationships take time.Another 'prime difficulty is the selfish tendency to think one 'possesses' the other, with an almost exclusive right to his time and attention .Similarly, friendships require bilateral reciprocal actions. in brief ,you must give as much as you take,Finally there is a question of nurturing, of cultivating one's own garden in the image of the French philosopher, Voltaire. Unless you spend reasonable time together, talking on the phone writing letters." ," Why is it so difficult to form friendships Perhaps the answer has something to do with the impatient temperament of some American People. It is posible,as Mr.Sifford states that we simply do not stay in one place long enough for a true friendship to develop. However,there can be no disgreement on the need for each of us to think carefully about the kind of friendships we want.As in all interpersonal relationship,success depends on clarity of pupose,openness to others ,willingness to experiment.The sharing of intimacies, including ultimately our fears as well as our dark dreams is the surest way to deepen friendships ." ," Isabel played more brilliantly than ever that afternoon, there was a thunder of applause from the audience. Her music teacher Serge hugged her ecstatically and told her Andreas Korda, the famous publisher wanted to invite her to have dinner. From the moment Isabel stepped into the foyer of the luxury hotel, Isabel knew immediately which one was Andreas Korda, even though she had never seen a photo of him. He was tall, with a lean, athletic physique. But it was his eyes that really captivated her as if he could see right into her soul.You're so young,' he murmured.'Even younger that I thought.'" ," 'I am 18!' she protested.His lips twitched. 'And I'm 32, but I admit that you play the violin like a mature woman, a woman who has known grief and passion, anger and joy. How is this possible?'Then she told him about her early talent, her mother didn't understand that music was her life, so she went to ask for the best teacher of the conservatorium when she was 10 years old.And that was how you met Serge?' she nodded, then asked: 'Are you happy when you became a millionaire?'Money isn't everything,' he said in a brooding tone, 'It hasn't much to do with happiness'.Are you unhappy?' she ventured." ," American astronaut Kaniel Bursch retruned to earth June 19th after a total of one-hundred ninety-six days in space.He and the other American crewmember Carl Waltz now hold the American record for the longest time spent in space on one flght Astronaut Bursch was chosen to live on the space station crew bacause he had spent almost three-thousand flight hours in more than thirty-five different aircraft. Hehad also flown three times as a crewmember of the space shuttle. Before living on the space station, he spent more than seven-hundred-forty hours in space.Mister Bursch is a graduate of the United states Naval Academy." ," He has advanced education in engineeringscience. He was selected by NASA in January 1990 and became an astronaut in July,1991. The Space Shuttle Endeavour was launched into space December 5th,2001.It was carrying two American astronauts and one Russian cosmonaut to the International Space Station.Daniel Bursch began writing on his one-hundred day in orbit,March 18th. He wrote the diary in an effort to give others a feel for what it is like to be a crewmember on the International space Station.Mister Bursch said the trip to the International space Station was a little different experience for him ."}; void interrupt (*oldtimer)(); void interrupt newtimer() { count++; oldtimer(); } void writefile() { int i; f1=fopen("c:\\mark.txt","w"); for(i=0;i<10;i++) { fwrite(&person[i],sizeof(person[i]),1,f1); } fclose(f1); } void readfile() { int i; for(i=0;i<10;i++) { fread(&person[i],sizeof(person[i]),1,f1); } } void newfile() { int i; f1=fopen("c:\\mark.txt","w"); for(i=0;i<10;i++) { person[i].noun=i+1; person[i].name[0]='C'; person[i].name[1]='P'; person[i].name[2]='U'; person[i].name[3]='\0'; person[i].speed=0; fwrite(&person[i],sizeof(person[i]),1,f1); } } int Hitword() { int sign=-1,a,b=0,n=-1,x=15,y=Y,i=0,j=0,k,true1=0,false1=0,timem,rad=0; float /*time,*/fold,speed; unsigned char zimo[][16][2]={ {0x00,0x40,0x47,0xFC,0x30,0x40,0x23,0xF8, 0x00,0x40,0x07,0xFE,0xF0,0x00,0x13,0xF8, 0x12,0x08,0x13,0xF8,0x12,0x08,0x13,0xF8, 0x16,0x08,0x1A,0x08,0x12,0x28,0x02,0x10}, {0x20,0x40,0x20,0x40,0xFC,0xA0,0x21,0x18, 0x43,0xF6,0x54,0x00,0xFC,0x04,0x53,0xD4, 0x12,0x54,0x1F,0xD4,0xF2,0x54,0x13,0xD4, 0x12,0x54,0x12,0x54,0x13,0x44,0x12,0x8C}, {0x0C,0x00,0x06,0x00,0x02,0x00,0x01,0x00, 0x03,0x00,0x02,0x80,0x02,0x80,0x04,0x40, 0x04,0x20,0x08,0x20,0x08,0x10,0x10,0x08, 0x20,0x0E,0x40,0x04,0x80,0x00,0x00,0x00}, {0x20,0x20,0x30,0x20,0x21,0x20,0x21,0x20, 0xFD,0xFE,0x25,0x20,0x26,0x20,0x44,0x20, 0x48,0x20,0x29,0xFC,0x10,0x20,0x28,0x20, 0x24,0x20,0x44,0x20,0x83,0xFE,0x00,0x00}, {0x04,0x00,0x04,0x00,0x07,0xF8,0x08,0x10, 0x10,0x20,0x24,0x40,0x42,0x80,0x01,0x00, 0x06,0x00,0x1F,0xF8,0xE8,0x08,0x08,0x08, 0x08,0x08,0x0F,0xF8,0x08,0x08,0x00,0x00} }; char t[11],str[11],ch,s[2],q[6][20]; rad=rand()%10; s[1]='\0'; /*a=strlen(p);*/ setcolor(15); settextstyle(0,0,1); cleardevice(); setfillstyle(1,14); bar(0,0,640,480); setcolor(BLACK); rectangle(10,10,620,440); setfillstyle(1,15); floodfill(100,100,BLACK); setfillstyle(1,7); bar(621,15,625,445); bar(15,441,625,445); setfillstyle(1,BLACK); /* bar(3,450,635,475); */ bar(15,380,615,405); setcolor(12); outtextxy(55,420,"QQ 43334708"); outtextxy(205,420,"BY chengstone"); outtextxy(370,420,"Email chengstone@21cn.com"); setcolor(BLACK); while(p[rad][i]!=0) { while(x<610&&p[rad][i]!=0) { s[0]=p[rad][i++]; outtextxy(x,y,s); x+=XMAX; } y+=YMAX; x=15; } x=15;y=YY;i=0; gotoxy(10,25);printf("version 1.0"); oldtimer=getvect(0x1c); disable(); setvect(0x1c,newtimer); enable(); gotoxy(40,25); printf("TIME %02d:%02d",b,0); if(getch()!=27) { while(p[rad][i]!=0) { while(x<610&&p[rad][i]!=0) { if(count>18){ gotoxy(40,25); printf("TIME %02d:%02d",b,++n); count=0; } if(n==59){ b++; n=-1; } gotoxy(55,25); printf("TRUE= %d FALSE= %d",true1,false1); outtextxy(x,y-10,"-"); if(kbhit()){ch=getch(); if(ch==27){killtimer();goto exit;} if(cmp(ch,p[rad][i])==0){ true1++; s[0]=p[rad][i++]; setcolor(WHITE); line(15,y-7,612,y-7); setcolor(BLUE); outtextxy(x,y,s); } else { i++; false1++; setcolor(WHITE); line(15,y-7,612,y-7); setcolor(RED); s[0]=ch; outtextxy(x,y,s); setcolor(BLACK); } x+=XMAX; } } y+=YMAX; x=15; } killtimer(); gotoxy(55,25); printf("TRUE= %d FALSE= %d",true1,false1); getch(); /* time=b+(float)n/60;*/ timem=b*60+n; fold=100*(float)true1/strlen(p[rad]); speed=((float)true1/timem)*60; score(); /*itoa(a,q[0],10);*/ itoa(strlen(p[rad]),q[0],10); itoa(b*60+n,q[1],10); itoa(true1,q[2],10); itoa(false1,q[3],10); itoa((int)fold,q[4],10); itoa((int)speed,q[5],10); y=100; x=370; settextstyle(0,0,2); for(i=0;i<6;i++) { outtextxy(x,y,q[i]); y+=54; } for(i=9;i>=0;i--) { if(speed>person[i].speed) { if(i!=9)person[i+1].speed=j; j=person[i].speed; /* 这里的j是原来的buf */ person[i].speed=(int)speed; sign=i; } } for(i=0;person[sign].name[i]!='\0';i++) { str[i]=person[sign].name[i]; } str[i]='\0'; for(i=sign+1;i<10;i++) { person[i].speed^=j; j^=person[i].speed; /* 这里的j是原来的buf */ person[i].speed^=j; } if(sign>=0) { setfillstyle(SOLID_FILL,BLUE); bar(145,415,500,440); x=150; y-=5; for(a=0;a<5;a++) { for(b=0;b<16;b++) for(j=0;j<2;j++) for(k=0;k<8;k++) { if(zimo[a][b][j]&(0x80>>k))putpixel(x+j*8+k,y+b,YELLOW); } x+=25; } settextstyle(0,0,1); outtextxy(x,y+5,":"); j=0; x+=10; while((ch=getch())!=13) { if(j!=10&&j>=0) { if(ch==8){ j--; if(j>=0){ x-=10; bar(x,y,x+10,y+13); } else j++; } else if(ch==27){} else { s[0]=ch; outtextxy(x,y+5,s); person[sign].name[j++]=ch; x+=10; } } else if(ch==8){ j--; if(j>=0){ x-=10; bar(x,y,x+10,y+13); } } } person[sign].name[j]='\0'; for(j=sign+1;j<10;j++) { for(i=0;person[j].name[i]!='\0';i++) { t[i]=person[j].name[i]; } t[i]='\0'; for(i=0;str[i]!='\0';i++) { person[j].name[i]=str[i]; } person[j].name[i]='\0'; for(i=0;t[i]!='\0';i++) { str[i]=t[i]; } str[i]='\0'; } writefile(); } else getch(); } else killtimer(); exit: return 1; }
[原创]一个CAI的程序