今天是圣诞,但是因为一个作业约会都成了泡沫了,惨啊。。。_派派后花园

用户中心 游戏论坛 社区服务
发帖 回复
阅读:645 回复:6

今天是圣诞,但是因为一个作业约会都成了泡沫了,惨啊。。。

刷新数据 楼层直达
ak47508

ZxID:2113000

等级: 略有小成
天天到处逛逛学点东西还是好的,有G就用起!没得就看T去~~~
举报 只看楼主 使用道具 楼主   发表于: 2008-12-25 0
今天是圣诞节,先祝各位节日快乐。
我呢还是一个学生,因为过几天就是要考试了,突然老师就来了一个N大的惊喜:明天将程序上交。做一个简单的C程序设计。。我汗啊。经过了长达四个小时的努力,我终于写完了,#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00
#include"conio.h"
#include"time.h"
#include"stdlib.h"
int k[17][24]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
           0,1,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,
           0,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,
           0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,
           0,3,1,1,1,1,0,1,1,1,4,1,0,1,0,1,1,1,1,1,1,1,0,0,
           0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,
           0,2,1,1,1,1,6,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,
           0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,0,
           0,1,1,1,1,1,1,1,1,1,1,5,1,1,1,0,1,0,0,1,0,0,0,0,
           0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,4,0,0,1,0,0,0,0,
           0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,1,0,
           0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,
           0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,
           0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1,3,1,1,1,1,1,0,0,
           0,2,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
           0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
           0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
           int en(int *b,int n)
           {int i;
           for(i=0;i<20;i++)
           if(b==n)return 0;
           return 1;
           }
           fu(int *b)
           {int i;
           for(i=0;i<20;i++)
           b=0;
           }
           void lostgame(int num)
           {
        textcolor(WHITE);
        gotoxy(11,22);
        cprintf("The sum of the Numbers you have eaten is:%d.",num);
        gotoxy(11,23);
        cprintf("Sorry,you have lost the game!Press any key to restart...");
        getch();
        gotoxy(11,22);
        cprintf("                                              ");
        gotoxy(11,23);
        cprintf("                                                      ");

         }
         void wingame()
         {
         textcolor(WHITE);
         gotoxy(11,22);
         cprintf("Yeah!Congratulations!You have won the game!");
         gotoxy(11,23);
         cprintf("Press any key to quit...");
         getch();
         window(1,1,25,80);
         textbackground(BLACK);
         textcolor(LIGHTGRAY);
         clrscr();
         exit(0);
         }
         main()
         {
         int i,j,key,num,b[20],p;
         char ch;
         aa:
         window(1,1,25,80);
         textbackground(LIGHTGREEN);
         textcolor(YELLOW);
         clrscr();
         fu(b);
         num=0;
         p=0;
         textcolor(LIGHTRED);
         gotoxy(18,1);
         cprintf("%c(UP)%c(DOWN)%c(LEFT)%c(RIGHT)",24,25,27,26);
         gotoxy(16,2);
         cprintf("Eat the numbers in your road whose sum is 7,");
         gotoxy(14,3);
         cprintf("and eat 7 in the end,then youwill win the game!");
         textcolor(MAGENTA);
         for(i=4;i<21;i++)
          for(j=20;j<44;j++)
         if(k[i-4][j-20]==0)
         {
          gotoxy(j,i);
          cprintf("%c",219);
          }
          else if(k[i-4][j-20]!=1)
          {
            gotoxy(j,i);
            cprintf("%d",k[i-4][j-20]);
          }
           textcolor(YELLOW);
           i=5;
           j=21;
           gotoxy(j,i);
           cprintf("1");
           gotoxy(33,5);
           cprintf("7");
           gotoxy(7,7);
           cprintf("num:%d",num);
           textcolor(WHITE);
           gotoxy(11,22);
           cprintf("Press any key to start game,Q key to quit...");
           ch=getch();
           if(ch=='Q'||ch=='q')
           {
         window(1,1,25,80);
         textbackground(BLACK);
         textcolor(LIGHTGRAY);
         clrscr();
         exit(0);
         }
         else
         {
            textcolor(YELLOW);
            gotoxy(11,22);
            cprintf("                               ");
            }
            do
            {
               key=bioskey(0);
               sound(200);
               delay(1000);
               nosound();
               switch(key)
               {
               case DOWN:
              {
                 if(k[i-4+1][j-20]==0)
                continue;
              if(k[i-4+1][j-20]!=1&&k[i-4+1][j-20]!=7&&en(b,i+j+1))
              {
                  num+=k[i-4+1][j-20];
                  b[p++]=i+j+1;
                  gotoxy(7,7);
                  cprintf("num:%d",num);
                  }
                  textcolor(YELLOW);
                  gotoxy(j,i++);
                  printf(" ");
                  gotoxy(j,i);
                  cprintf("1");
                  gotoxy(33,5);
                  if(k[i-4][j-20]==7&&num==7)
                wingame();
                else if(num!=7&&k[i-4][j-20]==7)
                {
                     lostgame(num);
                     goto aa;
                     }
                     break;
                }
                case UP:
                {
                 if(k[i-4-1][j-20]==0)
                   continue;
                   if(k[i-4-1][j-20]!=1&&k[i-4-1][j-20]!=7&&en(b,i+j-1))
                 {
                     num+=k[i-4-1][j-20];
                     b[p++]=i+j-1;
                     gotoxy(7,7);
                     cprintf("num:%d",num);
                 }
                 textcolor(YELLOW);
                 gotoxy(j,i--);
                 printf(" ");
                 gotoxy(j,i);
                 cprintf("1");
                 gotoxy(33,5);
                 if(k[i-4][j-20]==7&&num==7)
                    wingame();
                    else if(num!=7&&k[i-4][j-20]==7)
                    {
                    lostgame(num);
                    goto aa;
                    }
                    break;
                 }
                 case LEFT:
                 {
                   if(k[i-4][j-20-1]==0)
                     continue;
                     if(k[i-4][j-20-1]!=1&&k[i-4][j-20-1]!=7&&en(b,i+j-1))
                     {
                     num+=k[i-4][j-20-1];
                     b[p++]=i+j-1;
                     gotoxy(7,7);
                     cprintf("num:%d",num);
                     }
                     textcolor(YELLOW);
                     gotoxy(j--,i);
                     printf(" ");
                     gotoxy(j,i);
                     cprintf("1");
                     gotoxy(33,5);
                     if(k[i-4][j-20]==7&&num==7)
                    wingame();
                    else if(num!=7&&k[i-4][j-20]==7)
                    {
                       lostgame(num);
                       goto aa;
                       }
                       break;
                    }
                    case RIGHT:
                    {
                    if(k[i-4][j-20+1]==0)
                      continue;
                     if(k[i-4][j-20+1]!=1&&k[i-4][j-20+1]!=7&&en(b,i+j+1))
                       {
                       num+=k[i-4][j-20+1];
                       b[p++]=i+j+1;
                       gotoxy(7,7);
                       cprintf("num:%d",num);
                       }
                       textcolor(YELLOW);
                       gotoxy(j++,i);
                       printf(" ");
                       gotoxy(j,i);
                       cprintf("1");gotoxy(33,5);
                       if(k[i-4][j-20]==7&&num==7)
                       wingame();
                       else if(num!=7&&k[i-4][j-20]==7)
                       {
                     lostgame(num);
                     goto aa;
                     }
                     break;
                     }
                     default:
                       continue;
                       }
                    }while(1);
                }
这就是我们老师所说的简简单单的一个程序,害得我的约会都成了泡沫,伤心啊。
不过终于还是做完了,我得去陪下朋友了~各位岛上的朋友们节日快乐,不要像我那么倒霉就得了~~哈哈~晚安
生活就是要像逛论坛~每天都在更新~每天都会更精彩!
枯木花。

ZxID:2270187


等级: 文学大师
配偶: 鸭鸭~~~
丨过 去 的 日 子 ,回 不 来 。 丨
举报 只看该作者 沙发   发表于: 2008-12-25 0
  什么啊 没看明白

楼主留言:

一个C语言程序~我也是才学了不久~

              不 过 是 个 骗 子 而 已 。

゛臉紅紅....

ZxID:704295


等级: 内阁元老
把每一次都当作是最后一次。
举报 只看该作者 板凳   发表于: 2008-12-26 0
后面那一长串是什么东东····

楼主留言:

一串C语言代码而已


清芷泫音

ZxID:200124


等级: 内阁元老
珍爱生命,远离摩羯。
举报 只看该作者 地板   发表于: 2008-12-26 0
擦汗。。。当初C语言上机考
然后一位很厉害的帅哥坐我旁边帮我答题
哈哈

楼主留言:

要是谁帮我考就好了~~27号就是二级了,想想就有点毛毛的感觉`````

迷失弦月

ZxID:1895810


等级: 内阁元老
只爱礼礼,最爱礼礼
举报 只看该作者 4楼  发表于: 2008-12-26 0
汗   楼上的作弊也太厉害了吧
smallqi

ZxID:1960277


等级: 内阁元老
配偶: 泠叶
___ 风轻了,云淡了,心也随风而散了〃
举报 只看该作者 5楼  发表于: 2008-12-26 0
雪姐施展美人计,考试还不小菜一碟    
以前的那些不如意, 恰到好处的衬托了现在平淡的幸福…

浮生若梦。

ZxID:1850692


等级: 专栏作家
既不能只如初见..便相望于江湖...
举报 只看该作者 6楼  发表于: 2008-12-26 0
哎···C我觉得很好学啦···我现在学汇编·那叫一泡····
发帖 回复