欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

C語(yǔ)言

當(dāng)前位置:主頁(yè) > 軟件編程 > C語(yǔ)言 >

原創(chuàng)的C語(yǔ)言控制臺(tái)小游戲

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C語(yǔ)言|點(diǎn)擊: 次

最開(kāi)始左上色塊被感染,通過(guò)切換顏色,不斷感染同色色塊。亮點(diǎn)是可以切換圖案,設(shè)置方塊個(gè)數(shù)和最大限制次數(shù)。整體還是比較滿意,希望大神指教。

#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
 
int DIFFICULT=44;
int count=0 ;
int TYPE_SHAPE=2 ;
int flag=7 ;
int LINE=12;
 
struct MyStruct
{
  int shape ;
  int color ;
  int infect ;
};
 
void SetColor(unsigned short ForeColor,unsigned short BackGroundColor)
{
  HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleTextAttribute(hCon,ForeColor|BackGroundColor);
}
 
void WelcomeScr()
{
  int i;
  printf("\n\n\n\t\t");
  printf("●程序初始化中〉");
  for(i=0; i<=100; i++)
  {
    SetColor(i%6+8,0);
    printf("%3d",i);
    SetColor(15,0);
    printf(" %%");
    SetColor(i%6+8,0);
    printf(" Written by Oliver!");
    Sleep(20);
    printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  }
  printf("\a");
  Sleep(1000);
  system("cls");
  printf("\n\n\n\t\t");
  SetColor(15,0);
  printf("●請(qǐng)輸入方塊行數(shù) 〉 (最好不超過(guò)21行)");
  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  scanf("%d",&LINE);
  printf("\n\n\n\t\t");
  printf("●請(qǐng)輸入最大次數(shù) 〉");
  scanf("%d",&DIFFICULT);
  system("cls");
}
 
void Show()
{
  int i ;
  SetColor(15,0);
  printf("\n ※ 操作次數(shù): %-2d / %d  (共%3d個(gè)色塊)\n",count,DIFFICULT,LINE*LINE);
  printf("\n ※ 操作方法: ");
  for(i=1; i<7; i++)
  {
    SetColor(15,0);
    printf("%d.",i);
    SetColor(i+8,0);
    printf("%c ",TYPE_SHAPE);
  }
  SetColor(15,0);
  printf("7.");
  SetColor(9,0);
  printf("重");
  SetColor(10,0);
  printf("新");
  SetColor(11,0);
  printf("生");
  SetColor(12,0);
  printf("成 ");
  SetColor(15,0);
  printf("0.");
  SetColor(14,0);
  printf("改");
  SetColor(13,0);
  printf("變");
  SetColor(12,0);
  printf("圖");
  SetColor(11,0);
  printf("案 ");
  SetColor(15,0);
  printf("\n\n ※ 請(qǐng)按下 0 ~ 7 鍵位> ");
}
 
int Choose()
{
  int choose ;
  fflush(stdin);
  scanf("%d",&choose);
  switch(choose)
  {
  case 0 :
    TYPE_SHAPE++;
    if(TYPE_SHAPE==7)
    {
      TYPE_SHAPE=1 ;
    }
    return 0 ;
  case 1 :
    return 1 ;
  case 2 :
    return 2 ;
  case 3 :
    return 3 ;
  case 4 :
    return 4 ;
  case 5 :
    return 5 ;
  case 6 :
    return 6 ;
  case 7 :
    return 7 ;
  default :
    printf("\n\t\t\a● 輸入無(wú)效,請(qǐng)重新輸入!");
    Sleep(1000);
    return 0 ;
  }
}
 
void main()
{
  int i,j ;
  int num=0 ;
  char ch ;
  int cc ;
  int jj;
  struct MyStruct array[41][41];
  system("title 感染方塊 Oliver's QQ 564404096");
  srand((time(NULL)%100)*rand());
  WelcomeScr();
loop :
  for(i=0; i<LINE; i++)
  {
    for(j=0; j<LINE; j++)
    {
      array[i][j].shape=TYPE_SHAPE ;
      if(flag==7)
      {
        array[i][j].color=rand()%6+1 ;
        array[i][j].infect=0 ;
        count=0 ;
        cc=1 ;
      }
    }
  }
  printf("\n");
  array[0][0].infect=1 ;
  for(jj=0; jj<LINE; jj++)
  {
    for(i=0; i<LINE; i++)
    {
      for(j=0; j<LINE; j++)
      {
        if(array[i][j].color==array[i][j+1].color&&array[i][j].infect==1&&array[i][j+1].infect!=1)
        {
          array[i][j+1].infect=1 ;
        }
        if(array[i][j].color==array[i+1][j].color&&array[i][j].infect==1&&array[i+1][j].infect!=1)
        {
          array[i+1][j].infect=1 ;
        }
      }
    }
 
    for(i=LINE-1; i>0; i--)
    {
      for(j=LINE-1; j>0; j--)
      {
        if(array[i][j].color==array[i-1][j].color&&array[i][j].infect==1&&array[i-1][j].color!=1)
        {
          array[i-1][j].infect=1 ;
        }
        if(array[i][j].color==array[i][j-1].color&&array[i][j].infect==1&&array[i][j-1].color!=1)
        {
          array[i][j-1].infect=1 ;
        }
      }
    }
    cc=1 ;
    for(i=0; i<LINE; i++)
      for(j=0; j<LINE; j++)
      {
        if(array[i][j].infect==0)
        {
          cc=0 ;
          break ;
        }
      }
  }
  for(i=0; i<LINE; i++)
  {
    printf(" ");
    for(j=0; j<LINE; j++)
    {
      SetColor(array[i][j].color+8,0);
      printf("%c ",array[i][j]);
    }
    printf("\n");
  }
  Show();
  if(count<=DIFFICULT&&cc==1&&flag!=7&&flag!=0)
  {
    system("cls");
    printf("\n\n\n\n\t\t\t●%5d個(gè)色塊你用了%d步完成  ●",LINE*LINE,count);
    printf("\n\n\t\t\t● 恭喜你,您獲得了勝利!\n");
loop2 :
    printf("\n\t\t\t\a● 是否繼續(xù)?(Y/N)>");
    fflush(stdin);
    if((ch=getch())=='Y'||ch=='y')
    {
      system("cls");
      flag=7 ;
      goto loop ;
    }
    else if(ch=='n'||ch=='N')
    {
      system("cls");
      printf("\n\t\t\t● 謝 謝 您 的 使 用 !\n\n\t\t\t● 作 者: Oliver\n\n\t\t\t● Q Q: 564404096\n\n\t\t\t● 代 碼 原 創(chuàng),版 權(quán) 所 有 ●");
      Sleep(5000);
      exit(1);
    }
    else
    {
      printf("\n\n\t\t\t\a● 輸入錯(cuò)誤重新輸入 >");
      Sleep(1000);
      system("cls");
      goto loop2 ;
    }
  }
  else if(count>DIFFICULT)
  {
    system("cls");
    printf("\n\n\n\n\t\t\t\a● 很遺憾,您闖關(guān)失??!\n");
    goto loop2 ;
  }
  else
    ;
  flag=Choose();
  if(flag!=0)
  {
    array[0][0].color=flag ;
    if(flag!=7)
    {
      count++;
    }
    for(i=0; i<LINE; i++)
    {
      for(j=0; j<LINE; j++)
      {
        if(array[i][j].infect==1)
        {
          array[i][j].color=flag ;
        }
      }
    }
  }
  system("cls");
  goto loop ;
}

演示圖:

以上即是本文所述的全部?jī)?nèi)容了,希望大家能夠喜歡,能夠?qū)Υ蠹覍W(xué)習(xí)C有所幫助。

上一篇:C++程序檢測(cè)內(nèi)存泄漏的方法分享

欄    目:C語(yǔ)言

下一篇:C語(yǔ)言格式化輸入輸出函數(shù)詳解

本文標(biāo)題:原創(chuàng)的C語(yǔ)言控制臺(tái)小游戲

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/3138.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有