当前位置:首页 » 操作系统 » c棋牌游戏源码

c棋牌游戏源码

发布时间: 2022-05-13 04:41:43

① 求一些C语言小游戏的源代码,谢谢

“推箱子”C代码:

#include <stdio.h>

#include <conio.h>

#include<stdlib.h>

#include<windows.h>

int m =0; //m代表第几关

struct maps{short a[9][11]; };

struct maps map[5]={ 0,0,0,0,0,0,0,0,0,0,0, //共5关,每关9行11列

0,1,1,1,1,1,1,1,0,0,0,

0,1,0,0,0,0,0,1,1,1,0,

1,1,4,1,1,1,0,0,0,1,0, //0空地,1墙

1,5,0,0,4,0,0,4,0,1,0, //4是箱子,5是人

1,0,3,3,1,0,4,0,1,1,0, //3是目的地

1,1,3,3,1,0,0,0,1,0,0, //7是箱子在目的地(4+3)

0,1,1,1,1,1,1,1,1,0,0, //8是人在目的地(5+3)

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,1,1,1,0,0,0,0,0,

0,0,1,5,0,1,1,1,0,0,0,

0,0,1,0,4,0,0,1,0,0,0,

0,1,1,1,0,1,0,1,1,0,0,

0,1,3,1,0,1,0,0,1,0,0,

0,1,3,4,0,0,1,0,1,0,0,

0,1,3,0,0,0,4,0,1,0,0,

0,1,1,1,1,1,1,1,1,0,0,

0,0,0,0,0,0,0,0,0,0,0,

0,0,0,1,1,1,1,1,1,1,0,

0,0,1,1,0,0,1,0,5,1,0,

0,0,1,0,0,0,1,0,0,1,0,

0,0,1,4,0,4,0,4,0,1,0,

0,0,1,0,4,1,1,0,0,1,0,

1,1,1,0,4,0,1,0,1,1,0,

1,3,3,3,3,3,0,0,1,0,0,

1,1,1,1,1,1,1,1,1,0,0,

0,1,1,1,1,1,1,1,1,1,0,

0,1,0,0,1,1,0,0,0,1,0,

0,1,0,0,0,4,0,0,0,1,0,

0,1,4,0,1,1,1,0,4,1,0,

0,1,0,1,3,3,3,1,0,1,0,

1,1,0,1,3,3,3,1,0,1,1,

1,0,4,0,0,4,0,0,4,0,1,

1,0,0,0,0,0,1,0,5,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,1,1,1,1,1,1,0,0,

0,1,1,1,0,0,0,0,1,0,0,

1,1,3,0,4,1,1,0,1,1,0,

1,3,3,4,0,4,0,0,5,1,0,

1,3,3,0,4,0,4,0,1,1,0,

1,1,1,1,1,1,0,0,1,0,0,

0,0,0,0,0,1,1,1,1,0,0,

0,0,0,0,0,0,0,0,0,0,0 };

void DrMap( ) //绘制地图

{ CONSOLE_CURSOR_INFO cursor_info={1,0}; //隐藏光标的设置

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);

printf(" 推箱子");

printf(" ");

for (int i = 0; i < 9; i++)

{for (int j = 0; j < 11; j++)

{switch (map[m].a[i][j])

{case 0: printf(" "); break;

case 1: printf("■"); break;

case 3: printf("◎");break;

case 4: printf("□"); break;

case 5: printf("♀"); break; //5是人

case 7: printf("□"); break; //4 + 3箱子在目的地中

case 8: printf("♀");break; // 5 + 3人在目的地中

}

}

printf(" ");

}

}

void gtxy(int x, int y) //控制光标位置的函数

{ COORD coord;

coord.X = x;

coord.Y = y;

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);

}

void start( ) //开始游戏

{ int r, c; //人的下标

for (int i = 0; i < 9; i++)

{ for (int j = 0; j < 11; j++)

{if (map[m].a[i][j] == 5||map[m].a[i][j]==8) { r = i; c = j; } } //i j 人的下标

}

char key;

key = getch( );

switch (key)

{case 'W':

case 'w':

case 72:

if (map[m]. a[r - 1][c] == 0|| map[m]. a [r - 1][c] == 3)

{ gtxy(2*c+8,r-1+3); printf("♀"); // gtxy(2*c+8,r-1+3)是到指定位置输出字符

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r - 1][c] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r - 1][c] == 4 || map[m]. a [r - 1][c] == 7)

{ if (map[m]. a [r - 2][c] == 0 || map[m]. a [r - 2][c] == 3)

{ gtxy(2*c+8,r-2+3); printf("□"); gtxy(2*c+8,r-1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r - 2][c] += 4; map[m]. a [r - 1][c] += 1;

map[m]. a [r][c] -= 5; }

} break;

case 'S':

case 's':

case 80:

if (map[m]. a [r + 1][c] == 0 || map[m]. a [r + 1][c] == 3)

{ gtxy(2*c+8,r+1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r + 1][c] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r + 1][c] == 4 || map[m]. a [r+ 1][c] == 7)

{ if (map[m]. a [r + 2][c] == 0 || map[m]. a [r + 2][c] == 3)

{ gtxy(2*c+8,r+2+3); printf("□"); gtxy(2*c+8,r+1+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r + 2][c] += 4; map[m]. a [r + 1][c] += 1;

map[m]. a [r][c] -= 5; }

}break;

case 'A':

case 'a':

case 75:

if (map[m]. a [r ][c - 1] == 0 || map[m]. a [r ][c - 1] == 3)

{ gtxy(2*(c-1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r ][c - 1] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r][c - 1] == 4 || map[m]. a [r][c - 1] == 7)

{if (map[m]. a [r ][c - 2] == 0 || map[m]. a [r ][c - 2] == 3)

{ gtxy(2*(c-2)+8,r+3); printf("□"); gtxy(2*(c-1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r ][c - 2] += 4; map[m]. a [r ][c - 1] += 1;

map[m]. a [r][c] -= 5; }

}break;

case 'D':

case 'd':

case 77:

if (map[m]. a [r][c + 1] == 0 || map[m]. a [r][c + 1] == 3)

{ gtxy(2*(c+1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8) {gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r][c + 1] += 5; map[m]. a [r][c] -= 5; }

else if (map[m]. a [r][c + 1] == 4 || map[m]. a [r][c + 1] == 7)

{ if (map[m]. a [r][c + 2] == 0 || map[m]. a [r][c + 2] == 3)

{ gtxy(2*(c+2)+8,r+3); printf("□"); gtxy(2*(c+1)+8,r+3); printf("♀");

if(map[m]. a[r ][c] == 5){gtxy(2*c+8,r+3); printf(" "); }

if(map[m]. a[r ][c] == 8){gtxy(2*c+8,r+3); printf("◎");}

map[m]. a [r][c + 2] += 4; map[m]. a [r][c + 1] += 1;

map[m]. a [r][c] -= 5; }

}break;

}

}

int ifwan( ) //是否完成(1是0否)

{ if(m==0){if(map[m].a[5][2]==7&& map[m].a[5][3]==7&&

map[m].a[6][2]==7&& map[m].a[6][3]==7) return 1;}

if(m==1){if(map[m].a[5][2]==7&& map[m].a[6][2]==7&&

map[m].a[7][2]==7) return 1;}

if(m==2){if(map[m].a[7][1]==7&& map[m].a[7][2]==7&& map[m].a[7][3]==7&&

map[m].a[7][4]==7&& map[m].a[7][5]==7) return 1;}

if(m==3){if(map[m].a[4][4]==7&& map[m].a[4][5]==7&& map[m].a[4][6]==7&&

map[m].a[5][4]==7&& map[m].a[5][5]==7&& map[m].a[5][6]==7) return 1;}

if(m==4){if(map[m].a[3][2]==7&& map[m].a[4][1]==7&& map[m].a[4][2]==7&&

map[m].a[5][1]==7&& map[m].a[5][2]==7) return 1;}

return 0;

}

int main( ) //主函数

{ while (1)

{ system("cls");

DrMap( );

while (1)

{ start( );

if(ifwan()){printf("07");break;} //完成后响铃

}

m+=1;

}

return 0;

}

② 用C语言设计一个“三子棋”的游戏,要求用上下左右光标控制。要程序源代码!

#include <iostream>
#include <string>
using namespace std;
class CGobang //棋子类
{
private:
char chSort; //棋子的类别
int nWin; //赢棋的次数
int nLose; //输棋的次数
static int nDraw; //平局次数
static char achBoard[3][3]; //棋盘
static int nSize; //棋盘的尺寸 nSize X nSize
public:
CGobang(char chsort) //构造函数,决定一方棋子的类别
{
chSort=chsort;
nWin=nLose=nDraw=0;
}
void PlayTurn(void); //走1步棋
int Judge(); //判断是否连成一线,是则返回1,否则返回0
void Win(void); //赢棋
void Lose(void); //输棋
static void Draw(void); //平局
void PrintInfo(void); //输出总体情况
static void PrintBoard(void); //输出棋盘
static int GetFull(void); //判断棋盘是否已布满棋子
static void InitialBoard(void); //初始化棋盘

};
char CGobang::achBoard[3][3];
int CGobang::nSize = 3;
int CGobang::nDraw = 0;
void CGobang::Draw()
{
cout << "\n\n\t\t平局!\n\n";
nDraw++;
}

void CGobang::InitialBoard() //初始化棋盘
{
for(int i=0;i<nSize;i++)
for(int j=0;j<nSize;j++)
achBoard[i][j]=' ';
}
void CGobang::PrintBoard() //输出棋盘
{
cout << endl;
cout << " 1 2 3 " << endl;
cout << "1 " << achBoard[0][0] << " | " << achBoard[0][1] << " | " << achBoard[0][2] << endl;
cout << " ---|---|---" << endl;
cout << "2 " << achBoard[1][0] << " | " << achBoard[1][1] << " | " << achBoard[1][2] << endl;
cout << " ---|---|---" << endl;
cout << "3 " << achBoard[2][0] << " | " << achBoard[2][1] << " | " << achBoard[2][2] << endl;
cout << endl;
cout << endl;
}
int CGobang::GetFull() //判断棋盘是否布满棋子,若是返回1
{
for(int i=0;i<nSize;i++)
for(int j=0;j<nSize;j++)
if(achBoard[i][j]!=' ')
return 0;

return 1;
}
void CGobang::Win() //赢棋
{
cout << "\n\n\t\t"<<chSort<<"方获胜!\n\n";
nWin++;
}
void CGobang::Lose() //输棋
{
nLose++;
}
void CGobang::PlayTurn(void) //走1步棋
{
int nRow,nCol;
cout <<"现在该 "<<chSort<<" 方下棋,请输入棋盘坐标(x,y):";
do
{
cin >> nRow >> nCol; //输入坐标
if(nRow>nSize || nCol>nSize) //判断坐标越界
cout <<"输入的坐标越界,x与y的范围应小于等于"<<nSize<<",请重新输入\n";
else if(achBoard[nRow-1][nCol-1]!=' ') //判断坐标合理
cout <<"棋盘("<<nRow <<" ,"<<nCol <<")处已有棋子,请重新输入\n";
else
{
achBoard[nRow-1][nCol-1]=chSort; //在坐标处放上棋子
break; //退出循环
}
}while(1);
}
int CGobang::Judge() //判断是否棋子连成一线,若是返回1
{//以下是各种可能连成一线的情况
if(achBoard[0][0]==chSort && achBoard[1][1]==chSort && achBoard[2][2]==chSort)
return 1;
else if(achBoard[2][0]==chSort && achBoard[1][1]==chSort && achBoard[0][2]==chSort)
return 1;
else if(achBoard[0][0]==chSort && achBoard[1][0]==chSort && achBoard[2][0]==chSort)
return 1;
else if(achBoard[0][1]==chSort && achBoard[1][1]==chSort && achBoard[2][1]==chSort)
return 1;
else if(achBoard[0][2]==chSort && achBoard[1][2]==chSort && achBoard[2][2]==chSort)
return 1;
else if(achBoard[0][0]==chSort && achBoard[0][1]==chSort && achBoard[0][2]==chSort)
return 1;
else if(achBoard[1][0]==chSort && achBoard[1][1]==chSort && achBoard[1][2]==chSort)
return 1;
else if(achBoard[2][0]==chSort && achBoard[2][1]==chSort && achBoard[2][2]==chSort)
return 1;
else
return 0; //没有连成一线则返回0
}
void CGobang::PrintInfo(void) //打印总体情况
{
cout <<"Side "<<chSort<<"方共计赢 "<<nWin<<" 局,输 "<<nLose<<" 局,平 "<<nDraw<<" 局。"<<endl;
}
void PrintRule(void) //打印规则
{
cout << "\t\t欢迎使用三子连珠游戏!" << endl << endl;
cout << "\t游戏规则:" << endl;
cout << "\t1.每1步输入要下棋的格子的x,y坐标,按Enter键\n";
cout << "\t2.有1方首先3个棋子连成一线即判获胜\n";
cout << "\t3.当棋子布满棋盘但仍无获胜方即为平局\n";
cout << "\t4.X方先行\n";
cout << "\n\n\t\t请按任意键开始下棋!\n\n";
}
int JudgePlay(CGobang & SideX,CGobang & SideO) //每下1步要进行输赢的判断,有结果则返回1
{
if(SideX.Judge()) //X方获胜
{
SideX.Win();
SideO.Lose();
return 1;
}
else if(SideO.Judge()) //O方获胜
{
SideO.Win();
SideX.Lose();
return 1;
}
else
return 0;
}
void Play(CGobang & SideX,CGobang & SideO) //开始一局游戏
{
while(1)
{
CGobang::PrintBoard(); //输出棋盘
SideX.PlayTurn(); //X方下棋
if(JudgePlay(SideX,SideO)) //判断输赢
break;
if(CGobang::GetFull()) //判断是否平局
{
CGobang::Draw();
break;
}
CGobang::PrintBoard(); //输出棋盘
SideO.PlayTurn(); //O方下棋
if(JudgePlay(SideX,SideO)) //判断输赢
break;
if(CGobang::GetFull()) //判断是否平局
{
CGobang::Draw();
break;
}
}
}

int main(void)
{
CGobang SideX('X'),SideO('O'); //定义两个棋子类对象,分别代表X方与O方
PrintRule();
cin.get();
string strChoice;
do
{
CGobang::InitialBoard(); //初始化棋盘
Play(SideX,SideO); //开始下一局
cout << "是否继续(Y/N)?";
cin >> strChoice;
}while(strChoice == "Y" || strChoice == "y");

SideX.PrintInfo();
SideO.PrintInfo();
cout << "\n\n\t欢迎再次使用三子连珠游戏!" << endl << endl;
return 0;
}

③ (完整word版)纯C语言写的一个小型游戏 源代码

"扫雷"小游戏C代码

#include<stdio.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
main( )
{char a[102][102],b[102][102],c[102][102],w;
int i,j; /*循环变量*/
int x,y,z[999]; /*雷的位置*/
int t,s; /*标记*/
int m,n,lei; /*计数*/
int u,v; /*输入*/
int hang,lie,ge,mo; /*自定义变量*/
srand((int)time(NULL)); /*启动随机数发生器*/
leb1: /*选择模式*/
printf(" 请选择模式: 1.标准 2.自定义 ");
scanf("%d",&mo);
if(mo==2) /*若选择自定义模式,要输入三个参数*/
{do
{t=0; printf("请输入 行数 列数 雷的个数 ");
scanf("%d%d%d",&hang,&lie,&ge);
if(hang<2){printf("行数太少 "); t=1;}
if(hang>100){printf("行数太多 ");t=1;}
if(lie<2){printf("列数太少 ");t=1;}
if(lie>100){printf("列数太多 ");t=1;}
if(ge<1){printf("至少要有一个雷 ");t=1;}
if(ge>=(hang*lie)){printf("雷太多了 ");t=1;}
}while(t==1);
}
else{hang=10,lie=10,ge=10;} /*否则就是选择了标准模式(默认参数)*/
for(i=1;i<=ge;i=i+1) /*确定雷的位置*/
{do
{t=0; z[i]=rand( )%(hang*lie);
for(j=1;j<i;j=j+1){if(z[i]==z[j]) t=1;}
}while(t==1);
}
for(i=0;i<=hang+1;i=i+1) /*初始化a,b,c*/
{for(j=0;j<=lie+1;j=j+1) {a[i][j]='1'; b[i][j]='1'; c[i][j]='0';} }
for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1) {a[i][j]='+';} }
for(i=1;i<=ge;i=i+1) /*把雷放入c*/
{x=z[i]/lie+1; y=z[i]%lie+1; c[x][y]='#';}
for(i=1;i<=hang;i=i+1) /*计算b中数字*/
{for(j=1;j<=lie;j=j+1)
{m=48;
if(c[i-1][j-1]=='#')m=m+1; if(c[i][j-1]=='#')m=m+1;
if(c[i-1][j]=='#')m=m+1; if(c[i+1][j+1]=='#')m=m+1;
if(c[i][j+1]=='#')m=m+1; if(c[i+1][j]=='#')m=m+1;
if(c[i+1][j-1]=='#')m=m+1; if(c[i-1][j+1]=='#')m=m+1;
b[i][j]=m;
}
}
for(i=1;i<=ge;i=i+1) /*把雷放入b中*/
{x=z[i]/lie+1; y=z[i]%lie+1; b[x][y]='#';}

lei=ge; /*以下是游戏设计*/
do
{leb2: /*输出*/
system("cls");printf(" ");

printf(" ");
for(i=1;i<=lie;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c ",w);
}
printf(" |");
for(i=1;i<=lie;i=i+1){printf("---|");}
printf(" ");
for(i=1;i<=hang;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c |",w);
for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')printf(" |");
else printf(" %c |",a[i][j]);
}
if(i==2)printf(" 剩余雷个数");
if(i==3)printf(" %d",lei);
printf(" |");
for(j=1;j<=lie;j=j+1){printf("---|");}
printf(" ");
}

scanf("%d%c%d",&u,&w,&v); /*输入*/
u=u+1,v=v+1;
if(w!='#'&&a[u][v]=='@')
goto leb2;
if(w=='#')
{if(a[u][v]=='+'){a[u][v]='@'; lei=lei-1;}
else if(a[u][v]=='@'){a[u][v]='?'; lei=lei+1;}
else if(a[u][v]=='?'){a[u][v]='+';}
goto leb2;
}
a[u][v]=b[u][v];

leb3: /*打开0区*/
t=0;
if(a[u][v]=='0')
{for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=1;i<=hang;i=i+1)
{for(j=lie;j>=1;j=j-1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=hang;i>=1;i=i-1)
{for(j=1;j<=lie;j=j+1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1; if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}
for(i=hang;i>=1;i=i-1)
{for(j=lie;j>=1;j=j-1)
{s=0;
if(a[i-1][j-1]=='0')s=1; if(a[i-1][j+1]=='0')s=1;
if(a[i-1][j]=='0')s=1; if(a[i+1][j-1]=='0')s=1;
if(a[i+1][j+1]=='0')s=1;if(a[i+1][j]=='0')s=1;
if(a[i][j-1]=='0')s=1; if(a[i][j+1]=='0')s=1;
if(s==1)a[i][j]=b[i][j];
}
}

for(i=1;i<=hang;i=i+1) /*检测0区*/
{for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')
{if(a[i-1][j-1]=='+'||a[i-1][j-1]=='@'||a[i-1][j-1]=='?')t=1;
if(a[i-1][j+1]=='+'||a[i-1][j+1]=='@'||a[i-1][j+1]=='?')t=1;
if(a[i+1][j-1]=='+'||a[i+1][j-1]=='@'||a[i+1][j-1]=='?')t=1;
if(a[i+1][j+1]=='+'||a[i+1][j+1]=='@'||a[i+1][j+1]=='?')t=1;
if(a[i+1][j]=='+'||a[i+1][j]=='@'||a[i+1][j]=='?')t=1;
if(a[i][j+1]=='+'||a[i][j+1]=='@'||a[i][j+1]=='?')t=1;
if(a[i][j-1]=='+'||a[i][j-1]=='@'||a[i][j-1]=='?')t=1;
if(a[i-1][j]=='+'||a[i-1][j]=='@'||a[i-1][j]=='?')t=1;
}
}
}
if(t==1)goto leb3;
}

n=0; /*检查结束*/
for(i=1;i<=hang;i=i+1)
{for(j=1;j<=lie;j=j+1)
{if(a[i][j]!='+'&&a[i][j]!='@'&&a[i][j]!='?')n=n+1;}
}
}
while(a[u][v]!='#'&&n!=(hang*lie-ge));

for(i=1;i<=ge;i=i+1) /*游戏结束*/
{x=z[i]/lie+1; y=z[i]%lie+1; a[x][y]='#'; }
printf(" ");
for(i=1;i<=lie;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c ",w);
}
printf(" |");
for(i=1;i<=lie;i=i+1){printf("---|");}
printf(" ");
for(i=1;i<=hang;i=i+1)
{w=(i-1)/10+48; printf("%c",w);
w=(i-1)%10+48; printf("%c |",w);
for(j=1;j<=lie;j=j+1)
{if(a[i][j]=='0')printf(" |");
else printf(" %c |",a[i][j]);
}
if(i==2)printf(" 剩余雷个数");
if(i==3)printf(" %d",lei); printf(" |");
for(j=1;j<=lie;j=j+1) {printf("---|");}
printf(" ");
}
if(n==(hang*lie-ge)) printf("你成功了! ");
else printf(" 游戏结束! ");
printf(" 重玩请输入1 ");
t=0;
scanf("%d",&t);
if(t==1)goto leb1;
}

/*注:在DEV c++上运行通过。行号和列号都从0开始,比如要确定第0行第9列不是“雷”,就在0和9中间加入一个字母,可以输入【0a9】三个字符再按回车键。3行7列不是雷,则输入【3a7】回车;第8行第5列是雷,就输入【8#5】回车,9行0列是雷则输入【9#0】并回车*/

④ c游戏 源代码

很久以前自己写的,拿去看吧。
#include <stdio.h>
#include <stdlib.h>
main()
{
char a[3][3]={'\0'},b='1';
int i,j,k1,k2;randomize();
k1=random(3);k2=random(3);
a[k1][k2]=' ';
while(a[0][0]=='\0'||a[0][1]=='\0'||a[0][2]=='\0'||a[1][0]=='\0'||a[1][1]=='\0'||a[1][2]=='\0'||a[2][0]=='\0'||a[2][1]=='\0'||a[2][2]=='\0')
{
i=random(3),j=random(3);
if(a[i][j]=='\0')a[i][j]=b,b++;
}
loop:
clrscr();

for(i=0;i<3;i++) /*输出*/
{
for(j=0;j<3;j++)printf("%c ",a[i][j]);
putchar('\n');
}

for(b=0;b!=72&&b!=75&&b!=77&&b!=80;b=getch()); /*输入*/
switch(b) /*判断*/
{
case 72: if(2==k1)goto loop;
else
{
a[k1][k2]=a[k1+1][k2];
a[k1+1][k2]=' ';
k1++;
}
break;
case 75: if(2==k2)goto loop;
else
{
a[k1][k2]=a[k1][k2+1];
a[k1][k2+1]=' ';
k2++;
}
break;
case 80: if(0==k1)goto loop;
else
{
a[k1][k2]=a[k1-1][k2];
a[k1-1][k2]=' ';
k1--;
}
break;
case 77: if(0==k2)goto loop;
else
{
a[k1][k2]=a[k1][k2-1];
a[k1][k2-1]=' ';
k2--;
}
break;
}

/*是否完成*/
if(a[2][2]==' '&&a[0][0]=='1'&&a[0][1]=='2'&&a[0][2]=='3'&&a[1][0]=='4'&&a[1][1]=='5'&&a[1][2]=='6'&&a[2][0]=='7'&&a[2][1]=='8')
{
clrscr();
printf("1 2 3\n4 5 6\n7 8\nYes!!!");
getch();
}
else goto loop;
}

⑤ 谁能提供一个,C/C++编写的棋牌游戏的客户端或者服务器端的视频教程

沉 住 气 ,别 轻 浮

觉 得 还 是 安 全 才 放 心 是 吧

调 整 心 态 , 控 制 风 险

就 成 了http://ccc761.com?cbfbuui
-------------------------------------------
二元一次方程的整数解就是一个二元一次方程的解是个整数。
设:aX+bY=c,dX+eY=f.两个方程不得相似,否则ae-bd为零。
(相似方程举例:5X+10Y=30,10X+20Y=60,这两个方程简化后相等)
那么,X=(ce-bf)/(ae-bd),Y=(af-cd)/(ae-bd)
方程组aX+bY=c,式⑴,dX+eY=f,式⑵
将式⑵变形,得Y=(f-dX)/e,式⑶
As the young woman spoke, he rose, and advancing to the bed'

⑥ 20分求Visual C++ MFC 棋牌类游戏编程实例电子书和随书光盘源码,有的话请发邮箱[email protected]

分给的太少

⑦ 棋牌游戏代码哪里可以弄到有米有可以共享的

现在都在玩乐玩棋牌游戏,很不错的哦

⑧ 棋牌app有了源码以后怎么破解

摘要 如果你玩的是单机棋牌,那很好破解。

⑨ c ++五子棋源代码

其实,只需要做少量工作就可以了,判断下棋的人当前落子处,附近是否存在五子连珠就可以了,也就是4个方向(米字型),判断一下落子处附近是否有五子连珠就可以了

⑩ 我有一套游戏的源码 求高人指导开发架设


마슲

热点内容
服务器cpu能供多少电脑使用 发布:2024-10-09 23:05:21 浏览:349
算法和嵌入式 发布:2024-10-09 23:04:34 浏览:553
谷歌内部服务器错误是什么意思 发布:2024-10-09 22:39:27 浏览:904
java中todate 发布:2024-10-09 22:01:49 浏览:854
android短信权限设置 发布:2024-10-09 21:45:43 浏览:849
安卓手机转移数据为什么自动断开 发布:2024-10-09 21:40:52 浏览:88
什么是海关防盗密码锁 发布:2024-10-09 21:32:24 浏览:852
shell脚本的加减 发布:2024-10-09 21:23:23 浏览:402
安卓平板和苹果的平板有什么区别 发布:2024-10-09 20:26:37 浏览:428
上传速度对网速的影响吗 发布:2024-10-09 20:09:38 浏览:564