作者 主題: 怎麼把中獎ㄉ金額都+起來  (閱讀 3566 次)

0 會員 與 1 訪客 正在閱讀本文。

gcobt44292

  • 可愛的小學生
  • *
  • 文章數: 11
    • 檢視個人資料
怎麼把中獎ㄉ金額都+起來
« 於: 2013-12-20 16:25 »
int t(int h[][4]);
int main(void)
{
   int a[6][4],g=0;


   while(g!=5){
      system("cls");

      printf("歡迎來到!樂透世界~~~\n");


      printf("請輸入5組號碼,1組4個數字,介於0到9之間,請勿重複,多出一個數字出現錯誤請自行負責,別怪我!!\n");

      write(a);
      write(a);
      write(a);
      write(a);
      write(a);
      good(a);
      good(a);
      good(a);
      good(a);
      good(a);
      e(a);
      t(a);
      t(a);
      t(a);
      t(a);
      t(a);
      printf("還想繼續試試手氣嗎?\n");
      printf("繼續試手氣請按1\n");
      printf("不想試了請按5\n");
      scanf("%d",&g);


   }
   printf("~~~~~~~~~~~~~\n|歡迎下次蒞臨|\n~~~~~~~~~~~~~");

   system("pause");
   return 0;
}
int t(int h[][4])
{
   int i,j,counter;
   static int v=0;
   v++;
   if(v==1){
      for(i=0;i<4;i++){
         for(j=0;j<4;j++){
            if(h[0]==h[5][j]){
               counter++;
            }
         }
      }
      if(counter==4){
         printf("恭喜你中了4個數字拿到了10000元\n");
      }
      if(counter==3){
         printf("恭喜你中了3個數字拿到了1000元\n");
      }
      if(counter<3){
         printf("真可惜!你沒中,請再接再厲!\n");
      }

      return 0;
   }
   if(v==2){
      for(i=0;i<4;i++){
         for(j=0;j<4;j++){
            if(h[1]==h[5][j]){
               counter++;
            }
         }
      }
      if(counter==4){
         printf("恭喜你中了4個數字拿到了10000元\n");
      }
      if(counter==3){
         printf("恭喜你中了3個數字拿到了1000元\n");
      }
      if(counter<3){
         printf("真可惜!你沒中,請再接再厲!\n");
      }

      return 0;
   }
   if(v==3){
      for(i=0;i<4;i++){
         for(j=0;j<4;j++){
            if(h[2]==h[5][j]){
               counter++;
            }
         }
      }
      if(counter==4){
         printf("恭喜你中了4個數字拿到了10000元\n");
      }
      if(counter==3){
         printf("恭喜你中了3個數字拿到了1000元\n");
      }
      if(counter<3){
         printf("真可惜!你沒中,請再接再厲!\n");
      }

      return 0;
   }
   if(v==4){
      for(i=0;i<4;i++){
         for(j=0;j<4;j++){
            if(h[3]==h[5][j]){
               counter++;
            }
         }
      }
      if(counter==4){
         printf("恭喜你中了4個數字拿到了10000元\n");
      }
      if(counter==3){
         printf("恭喜你中了3個數字拿到了1000元\n");
      }
      if(counter<3){
         printf("真可惜!你沒中,請再接再厲!\n");
      }

      return 0;
   }
   if(v==5){
      for(i=0;i<4;i++){
         for(j=0;j<4;j++){
            if(h[4]==h[5][j]){
               counter++;
            }
         }
      }
      if(counter==4){
         printf("恭喜你中了4個數字拿到了10000元\n");
      }
      if(counter==3){
         printf("恭喜你中了3個數字拿到了1000元\n");
      }
      if(counter<3){
         printf("真可惜!你沒中,請再接再厲!\n");
      }
      v=0;
      return 0;
   }
}