Error[8]: Undefined offset: 13, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

1、首先打开浏览器搜索美图秀秀,点击带官网的链接进入主业

2、然后以后找到拼图功能,很好找就在首页

3、打开拼图以后选择拼接

4、找到需要拼接的,然后打开,按住Ctrl的同时可以选择多张添加

5、添加完照片以后,可以按自己需要调成是竖版拼接还是横版拼接,也可以左右上下拉动调整位置

6、把边框大小调节成0,无缝拼接,一张完整的照片就搞定

7、最后选择好存储路径,点击保存就大功告成

“推箱子”C代码:

#include <stdioh>

#include <conioh>

#include<stdlibh>

#include<windowsh>

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("\n\n \t\t\b推箱子");

printf("\n \t");

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("\n\t");

}

}

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

{ COORD coord;

coordX = x;

coordY = 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(2c+8,r-1+3); printf("♀");  // gtxy(2c+8,r-1+3)是到指定位置输出字符

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

       if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r-2+3); printf("□"); gtxy(2c+8,r-1+3); printf("♀");

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

          if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+1+3); printf("♀");

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

        if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+2+3); printf("□"); gtxy(2c+8,r+1+3); printf("♀");

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

           if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

         if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

           if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

         if(map[m] a[r ][c] == 8) {gtxy(2c+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(2c+8,r+3); printf("  "); }

          if(map[m] a[r ][c] == 8){gtxy(2c+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("           }7");break;} //完成后响铃

       m+=1;

     }

  return 0;

}

手机上可以用美图秀秀把两张合成一张,方法如下:

[+++]

1、打开美图秀秀,如图,找到拼图,点击进入。

2、进入后如图,添加两张,点击开始拼图。

3、进入后如图,我们看到有模板、海报、自由、拼接四种模式。

4、如图,选择模板,将两张合成在一起。

5、也可以根据自身爱好选择其他模式,比如自由,或拼接。

我给你2个贪吃蛇c++代码

(1):

#include <stdioh>

#include <windowsh>

#include <timeh>

#include <conioh>

#include <stdlibh>

//方向键的ASCLL值:上72,左75,右77,下80

//背景颜色的代码: 0=黑色  1蓝色 2 绿色 3湖蓝色 4红色 5紫色 6** 7白色 8灰色 9淡蓝色

//改变当前光标方块的背景颜色和字体颜色//

void BackGround(unsigned int ForeColor = 7, unsigned int BackGroundColor = 0) {

HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);  //获取控制台的句柄

SetConsoleTextAttribute(handle, ForeColor + BackGroundColor 0x10);//改变当前光标的背景和字体颜色

}

//改变光标的位置//

void gotoxy(int x, int y) {8

HANDLE handle;

COORD coord;   //获取坐标轴结构体

coordX = x;

coordY = y;

handle = GetStdHandle(STD_OUTPUT_HANDLE);  //获取控制台句柄,值为-11

SetConsoleCursorPosition(handle, coord);   //移动光标到x,y处

}

//初始化地图数据//

void restart(int bk[20][20], int look[4], int move[20][20]) {

//bk为总的地图数据记录整个地图,为1时表示墙体,为2时表示果实,为3时表示蛇

//look记录数据,为0时表示朝向,为1时表示长度,为3时表示胜负情况,为4表示分数

//move记录蛇走过的路程,用来打印蛇时判断用

int pp, qq;  //用来记录获取的随机坐标

//接下来要初始化整个地图//

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

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

if (i == 0 || i == 16 || j == 0 || j == 16)  bk[i][j] = 1;//1表示墙体

else bk[i][j] = 0; //0表示什么都没有

move[i][j] = 0;    //该数组用来记录蛇移动的轨迹

}

//将蛇初始化在8,8坐标上

bk[8][8] = 3;

move[8][8] = 1;//则此时8,8,上的轨迹就应该记录为1

move[0][0] = 1;//用此来记录步数

pp = rand() % 15 + 1;//范围是1-15

qq = rand() % 15 + 1;

bk[pp][qq] = 2;//表示这个位置有果实了

look[0] = 1;//表示朝向,向上

look[1] = 1;//表示长度

look[2] = 0;//当为1是表示失败

look[3] = 0;//记录得分

//接下来要绘制地图//

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

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

gotoxy(i 2, j);//光标移动,每个光标都是矩形

switch (bk[i][j]) {

case 0:

BackGround(0, 0);

break;//如果没有东西打印黑色

case 1:

BackGround(0, 1);

break;//墙打印蓝色

case 2:

BackGround(0, 2);

break;//果实打印绿色

case 3:

BackGround(0, 3);

break;//蛇打印湖蓝色

default:

break;

}

printf("  ");//地图中直接就是涂空格符

}

//接下来要显示积分//

gotoxy(35, 0);

BackGround(7, 0);//用白字黑底打印

printf("现在得分是:%d,请再接再厉!^_^", look[2]);

}

//运动主体//

void map(int bk[20][20], int look[4], int xy[2], int move[20][20]) {

//bk是地图信息,look作数据记录,xy记录坐标,move记录蛇的运动轨迹

int b[10], qq=0, pp=0;//b用来吸收输入,qq和pp用来随机初始化果实坐标

if (kbhit()) {//记录按下的是哪个方向键

b[0] = getch();//用b来记录

if (b[0] == 224)  b[0] = getch();//如果为224表示为方向键,但是要再一次获取才行

if (b[0] == 72 && look[0] != 2)

//如果输入的为上并且朝向不为下

look[0] = 1;

if (b[0] == 80 && look[0] != 1)

look[0] = 2;

if (b[0] == 75 && look[0] != 4)

look[0] = 3;

if (b[0] == 77 && look[0] != 3)

look[0] = 4;

}

switch (look[0]) {

case 1:

//往上走

xy[1]--;

break;

case 2:

//往下走

xy[1]++;

break;

case 3:

//往左走

xy[0]--;

break;

case 4:

//往右走

xy[0]++;

break;

}

//接下来蛇就开始走动了//

move[0][0]++;//蛇的步数加一

move[xy[0]][xy[1]] = move[0][0];//记录当前格子中蛇的轨迹

gotoxy(35, 2);

BackGround(7, 0);

printf("横坐标:%d,纵坐标:%d", xy[0],xy[1]);

gotoxy(xy[0] 2, xy[1]);//这里蛇头就往前移动了

BackGround(0, 3);//与蛇体一个颜色

printf("  ");

//如果吃了果实//

if (bk[xy[0]][xy[1]] == 2) {

look[2]++;//分数加一

look[1]++;//长度加一

//更新分数

gotoxy(35, 0);

BackGround(7, 0);

printf("现在得分是:%d,请再接再厉!^_^", look[2]);

while (bk[pp][qq] != 0) {

pp = rand() % 15 + 1;

qq = rand() % 15 + 1;

}

bk[pp][qq] = 2;//将这个地方变为果实

gotoxy(pp 2, qq);

BackGround(0, 2);

printf("  ");

}

//如果撞了墙或者自己//

if (bk[xy[0]][xy[1]] == 1 || bk[xy[0]][xy[1]] == 3) {

look[3] = 1;//表示已经输了

gotoxy(6, 6);

BackGround(7, 0);

printf("你输了,最后得分:%d", look[2]);

}

bk[xy[0]][xy[1]] = 3;//使这个位置变成蛇

//接下来要检测蛇然后刷新蛇的位置//

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

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

if (move[i][j] == move[xy[0]][xy[1]] - look[1]){

//如果符合这个条件,则表示蛇已经移动出这个位置了

//要删除这个位置的蛇尾巴

//一次只有一个方块会符合要求吧?

bk[i][j] = 0;

gotoxy(i 2, j);

BackGround(0, 0);

printf("  ");

break;//一次只找一个

}

}

end:;

}

int main() {

int bk[20][20], xy[2], move[20][20], look[4];

xy[1] = xy[0] = 8;

srand((unsigned) time(NULL));//初始化随机种子

system("pause");

restart(bk, look, move);

while (look[3] == 0) {

Sleep(200);//休眠400ms一次

map(bk, look, xy, move);

}

system("pause");

printf("游戏结束,谢谢游玩!^_^");

return 0;

}

(2):

#include <stdioh>

#include <windowsh>

#include<conioh>

#include <stdlibh>

#include<timeh>

#define X 23//地图的x轴

#define Y 75//地图的y轴

#define UP 0

#define DOWN 1

#define LEFT 2

#define RIGHT 3

#define WAIT_TIME 200//等待蛇刷新的时间,可以说是速度  修改可变速

int map_0[X][Y];//地图

int Snake[XY][2]; // 蛇

int Slength; //蛇的长度

int direction;

int score=0;

bool pdEatFood=false;

void csh();

void huaMap();

void huaSnake();

void gotoxy(int x,int y);

void move();

void intokey();

int check(int x,int y);

void putfood();

bool gameover();

void dy_fs();

int main()

{

csh();

huaMap();

putfood();

while(1)

{

huaSnake();            

Sleep(WAIT_TIME);

intokey();

move();

dy_fs();

if(gameover())

{

system("cls");          //清除屏幕内容

printf("Game Over\n");

system("pause");

getchar();

break;

}

if(map_0[Snake[0][0]][Snake[0][1]]==-1)

{

map_0[Snake[0][0]][Snake[0][1]]=0;

pdEatFood=true;

putfood();

score+=10;

}

}

return 0;

}

void csh()//初始化

{

srand((unsigned)time(NULL)); //设置种子为现在的时间

Slength=4;

gotoxy(0,0);

CONSOLE_CURSOR_INFO cursor_info = {1, 0}; //清除光标

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);

int x,y;

Snake[0][0]=X/2;

Snake[0][1]=Y/2;

for(x=0;x<X;x++){

map_0[x][0]=1;

map_0[x][Y-1]=1;

}

for(y=1;y<Y-1;y++){

map_0[0][y]=1;

map_0[X-1][y]=1;

}

for(x=1;x<4;x++){ //初始化蛇的坐标

Snake[x][0]=Snake[0][0]+x;

Snake[x][1]=Snake[0][1];

}

direction=UP;

}

void huaMap()//画地图

{

int x,y;

for(x=0;x<X101;x++){

for(y=0;y<Y101;y++){

if(map_0[x][y]==1){

printf("#");

}

if(map_0[x][y]==0){

printf(" ");

}

}

printf("\n");

}

}

void huaSnake()//画蛇

{

int x;

for(x=0;x<Slength;x++)

{

gotoxy(Snake[x][0],Snake[x][1]);

printf("@");

}

}

void gotoxy(int i,int j)//移动光标

{

COORD position={j,i};

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),position);

}

void move()

{

int i;

gotoxy(Snake[Slength-1][0],Snake[Slength-1][1]);//擦除尾巴

printf(" ");                          

for(i=Slength-1;i>0;i--)    //从尾巴开始,每一个点的位置等于它前面一个点的位置

{

Snake[i][0]=Snake[i-1][0];

Snake[i][1]=Snake[i-1][1];

}

switch(direction)

{

case UP:

Snake[0][0]--;

break;

case DOWN:

Snake[0][0]++;

break;

case LEFT:

Snake[0][1]--;

break;

case RIGHT:

Snake[0][1]++;

break;

}

if(pdEatFood){

Slength++;

pdEatFood=false;

}

}

void intokey()

{

if(kbhit()!=0)          //kbhit()函数 检查当前是否有键盘输入,若有则返回一个非0值,否则返回0

{

char in;

while(!kbhit()==0)  //如果玩家输入了多个按键,以最后一个按键为准

in=getch();

switch(in)

{

case 'w':

case 'W':

if(direction!=DOWN)         //防止缩头

direction=UP;

break;

case 's':

case 'S':

if(direction!=UP)

direction=DOWN;

break;

case 'a':

case 'A':

if(direction!=RIGHT)

direction=LEFT;

break;

case 'd':

case 'D':

if(direction!=LEFT)

direction=RIGHT;

break;

case 'p':

case 'P':

gotoxy(X,0);      

system("pause");

gotoxy(X,0);

printf("                   ");  // 消去下面的按任意键继续

break;

}

}

}

int check(int ii,int jj){// 检查是否能投放食物

if(map_0[ii][jj]==1)

return 0;

if(ii==0 || jj==0 || ii==X-1 || jj==Y-1)

return 0;

int i;

for(i=0;i<Slength;i++){

if(ii==Snake[i][0] && jj==Snake[i][1])

return 0;

}

return 1;

}

void putfood()

{

int i,j;

do{

i=rand()%X;

j=rand()%Y;

}while(check(i,j)==0);

map_0[i][j]=-1;

gotoxy(i,j);

printf("$");

}

bool gameover()

{

bool isgameover=false;

int sX,sY;

sX=Snake[0][0],sY=Snake[0][1];

if(sX==0 || sX==X-1 || sY==0 || sY==Y-1)

isgameover=true;

int i;

for(i=1;i<Slength;i++){

if(sX==Snake[i][0] && sY==Snake[i][1])

isgameover=true;

}

return isgameover;

}

void dy_fs()

{

gotoxy(X,0);

printf("(c)Geek------2018122");

gotoxy(X+1,0);

printf("最终得分: %d",score);

}

管庆帆c/c++大师)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
怎么做出两张图片拼在一起的图片_CMS教程_内存溢出

怎么做出两张图片拼在一起的图片

怎么做出两张图片拼在一起的图片,第1张

1、首先打开浏览器搜索美图秀秀,点击带官网的链接进入主业

2、然后以后找到拼图功能,很好找就在首页

3、打开拼图以后选择拼接

4、找到需要拼接的,然后打开,按住Ctrl的同时可以选择多张添加

5、添加完照片以后,可以按自己需要调成是竖版拼接还是横版拼接,也可以左右上下拉动调整位置

6、把边框大小调节成0,无缝拼接,一张完整的照片就搞定

7、最后选择好存储路径,点击保存就大功告成

“推箱子”C代码:

#include <stdioh>

#include <conioh>

#include<stdlibh>

#include<windowsh>

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("\n\n \t\t\b推箱子");

printf("\n \t");

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("\n\t");

}

}

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

{ COORD coord;

coordX = x;

coordY = 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(2c+8,r-1+3); printf("♀");  // gtxy(2c+8,r-1+3)是到指定位置输出字符

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

       if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r-2+3); printf("□"); gtxy(2c+8,r-1+3); printf("♀");

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

          if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+1+3); printf("♀");

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

        if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+2+3); printf("□"); gtxy(2c+8,r+1+3); printf("♀");

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

           if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

         if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

           if(map[m] a[r ][c] == 8){gtxy(2c+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(2c+8,r+3); printf("  "); }

         if(map[m] a[r ][c] == 8) {gtxy(2c+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(2c+8,r+3); printf("  "); }

          if(map[m] a[r ][c] == 8){gtxy(2c+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("           }7");break;} //完成后响铃

       m+=1;

     }

  return 0;

}

手机上可以用美图秀秀把两张合成一张,方法如下:

1、打开美图秀秀,如图,找到拼图,点击进入。

2、进入后如图,添加两张,点击开始拼图。

3、进入后如图,我们看到有模板、海报、自由、拼接四种模式。

4、如图,选择模板,将两张合成在一起。

5、也可以根据自身爱好选择其他模式,比如自由,或拼接。

我给你2个贪吃蛇c++代码

(1):

#include <stdioh>

#include <windowsh>

#include <timeh>

#include <conioh>

#include <stdlibh>

//方向键的ASCLL值:上72,左75,右77,下80

//背景颜色的代码: 0=黑色  1蓝色 2 绿色 3湖蓝色 4红色 5紫色 6** 7白色 8灰色 9淡蓝色

//改变当前光标方块的背景颜色和字体颜色//

void BackGround(unsigned int ForeColor = 7, unsigned int BackGroundColor = 0) {

HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);  //获取控制台的句柄

SetConsoleTextAttribute(handle, ForeColor + BackGroundColor 0x10);//改变当前光标的背景和字体颜色

}

//改变光标的位置//

void gotoxy(int x, int y) {8

HANDLE handle;

COORD coord;   //获取坐标轴结构体

coordX = x;

coordY = y;

handle = GetStdHandle(STD_OUTPUT_HANDLE);  //获取控制台句柄,值为-11

SetConsoleCursorPosition(handle, coord);   //移动光标到x,y处

}

//初始化地图数据//

void restart(int bk[20][20], int look[4], int move[20][20]) {

//bk为总的地图数据记录整个地图,为1时表示墙体,为2时表示果实,为3时表示蛇

//look记录数据,为0时表示朝向,为1时表示长度,为3时表示胜负情况,为4表示分数

//move记录蛇走过的路程,用来打印蛇时判断用

int pp, qq;  //用来记录获取的随机坐标

//接下来要初始化整个地图//

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

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

if (i == 0 || i == 16 || j == 0 || j == 16)  bk[i][j] = 1;//1表示墙体

else bk[i][j] = 0; //0表示什么都没有

move[i][j] = 0;    //该数组用来记录蛇移动的轨迹

}

//将蛇初始化在8,8坐标上

bk[8][8] = 3;

move[8][8] = 1;//则此时8,8,上的轨迹就应该记录为1

move[0][0] = 1;//用此来记录步数

pp = rand() % 15 + 1;//范围是1-15

qq = rand() % 15 + 1;

bk[pp][qq] = 2;//表示这个位置有果实了

look[0] = 1;//表示朝向,向上

look[1] = 1;//表示长度

look[2] = 0;//当为1是表示失败

look[3] = 0;//记录得分

//接下来要绘制地图//

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

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

gotoxy(i 2, j);//光标移动,每个光标都是矩形

switch (bk[i][j]) {

case 0:

BackGround(0, 0);

break;//如果没有东西打印黑色

case 1:

BackGround(0, 1);

break;//墙打印蓝色

case 2:

BackGround(0, 2);

break;//果实打印绿色

case 3:

BackGround(0, 3);

break;//蛇打印湖蓝色

default:

break;

}

printf("  ");//地图中直接就是涂空格符

}

//接下来要显示积分//

gotoxy(35, 0);

BackGround(7, 0);//用白字黑底打印

printf("现在得分是:%d,请再接再厉!^_^", look[2]);

}

//运动主体//

void map(int bk[20][20], int look[4], int xy[2], int move[20][20]) {

//bk是地图信息,look作数据记录,xy记录坐标,move记录蛇的运动轨迹

int b[10], qq=0, pp=0;//b用来吸收输入,qq和pp用来随机初始化果实坐标

if (kbhit()) {//记录按下的是哪个方向键

b[0] = getch();//用b来记录

if (b[0] == 224)  b[0] = getch();//如果为224表示为方向键,但是要再一次获取才行

if (b[0] == 72 && look[0] != 2)

//如果输入的为上并且朝向不为下

look[0] = 1;

if (b[0] == 80 && look[0] != 1)

look[0] = 2;

if (b[0] == 75 && look[0] != 4)

look[0] = 3;

if (b[0] == 77 && look[0] != 3)

look[0] = 4;

}

switch (look[0]) {

case 1:

//往上走

xy[1]--;

break;

case 2:

//往下走

xy[1]++;

break;

case 3:

//往左走

xy[0]--;

break;

case 4:

//往右走

xy[0]++;

break;

}

//接下来蛇就开始走动了//

move[0][0]++;//蛇的步数加一

move[xy[0]][xy[1]] = move[0][0];//记录当前格子中蛇的轨迹

gotoxy(35, 2);

BackGround(7, 0);

printf("横坐标:%d,纵坐标:%d", xy[0],xy[1]);

gotoxy(xy[0] 2, xy[1]);//这里蛇头就往前移动了

BackGround(0, 3);//与蛇体一个颜色

printf("  ");

//如果吃了果实//

if (bk[xy[0]][xy[1]] == 2) {

look[2]++;//分数加一

look[1]++;//长度加一

//更新分数

gotoxy(35, 0);

BackGround(7, 0);

printf("现在得分是:%d,请再接再厉!^_^", look[2]);

while (bk[pp][qq] != 0) {

pp = rand() % 15 + 1;

qq = rand() % 15 + 1;

}

bk[pp][qq] = 2;//将这个地方变为果实

gotoxy(pp 2, qq);

BackGround(0, 2);

printf("  ");

}

//如果撞了墙或者自己//

if (bk[xy[0]][xy[1]] == 1 || bk[xy[0]][xy[1]] == 3) {

look[3] = 1;//表示已经输了

gotoxy(6, 6);

BackGround(7, 0);

printf("你输了,最后得分:%d", look[2]);

}

bk[xy[0]][xy[1]] = 3;//使这个位置变成蛇

//接下来要检测蛇然后刷新蛇的位置//

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

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

if (move[i][j] == move[xy[0]][xy[1]] - look[1]){

//如果符合这个条件,则表示蛇已经移动出这个位置了

//要删除这个位置的蛇尾巴

//一次只有一个方块会符合要求吧?

bk[i][j] = 0;

gotoxy(i 2, j);

BackGround(0, 0);

printf("  ");

break;//一次只找一个

}

}

end:;

}

int main() {

int bk[20][20], xy[2], move[20][20], look[4];

xy[1] = xy[0] = 8;

srand((unsigned) time(NULL));//初始化随机种子

system("pause");

restart(bk, look, move);

while (look[3] == 0) {

Sleep(200);//休眠400ms一次

map(bk, look, xy, move);

}

system("pause");

printf("游戏结束,谢谢游玩!^_^");

return 0;

}

(2):

#include <stdioh>

#include <windowsh>

#include<conioh>

#include <stdlibh>

#include<timeh>

#define X 23//地图的x轴

#define Y 75//地图的y轴

#define UP 0

#define DOWN 1

#define LEFT 2

#define RIGHT 3

#define WAIT_TIME 200//等待蛇刷新的时间,可以说是速度  修改可变速

int map_0[X][Y];//地图

int Snake[XY][2]; // 蛇

int Slength; //蛇的长度

int direction;

int score=0;

bool pdEatFood=false;

void csh();

void huaMap();

void huaSnake();

void gotoxy(int x,int y);

void move();

void intokey();

int check(int x,int y);

void putfood();

bool gameover();

void dy_fs();

int main()

{

csh();

huaMap();

putfood();

while(1)

{

huaSnake();            

Sleep(WAIT_TIME);

intokey();

move();

dy_fs();

if(gameover())

{

system("cls");          //清除屏幕内容

printf("Game Over\n");

system("pause");

getchar();

break;

}

if(map_0[Snake[0][0]][Snake[0][1]]==-1)

{

map_0[Snake[0][0]][Snake[0][1]]=0;

pdEatFood=true;

putfood();

score+=10;

}

}

return 0;

}

void csh()//初始化

{

srand((unsigned)time(NULL)); //设置种子为现在的时间

Slength=4;

gotoxy(0,0);

CONSOLE_CURSOR_INFO cursor_info = {1, 0}; //清除光标

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);

int x,y;

Snake[0][0]=X/2;

Snake[0][1]=Y/2;

for(x=0;x<X;x++){

map_0[x][0]=1;

map_0[x][Y-1]=1;

}

for(y=1;y<Y-1;y++){

map_0[0][y]=1;

map_0[X-1][y]=1;

}

for(x=1;x<4;x++){ //初始化蛇的坐标

Snake[x][0]=Snake[0][0]+x;

Snake[x][1]=Snake[0][1];

}

direction=UP;

}

void huaMap()//画地图

{

int x,y;

for(x=0;x<X101;x++){

for(y=0;y<Y101;y++){

if(map_0[x][y]==1){

printf("#");

}

if(map_0[x][y]==0){

printf(" ");

}

}

printf("\n");

}

}

void huaSnake()//画蛇

{

int x;

for(x=0;x<Slength;x++)

{

gotoxy(Snake[x][0],Snake[x][1]);

printf("@");

}

}

void gotoxy(int i,int j)//移动光标

{

COORD position={j,i};

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),position);

}

void move()

{

int i;

gotoxy(Snake[Slength-1][0],Snake[Slength-1][1]);//擦除尾巴

printf(" ");                          

for(i=Slength-1;i>0;i--)    //从尾巴开始,每一个点的位置等于它前面一个点的位置

{

Snake[i][0]=Snake[i-1][0];

Snake[i][1]=Snake[i-1][1];

}

switch(direction)

{

case UP:

Snake[0][0]--;

break;

case DOWN:

Snake[0][0]++;

break;

case LEFT:

Snake[0][1]--;

break;

case RIGHT:

Snake[0][1]++;

break;

}

if(pdEatFood){

Slength++;

pdEatFood=false;

}

}

void intokey()

{

if(kbhit()!=0)          //kbhit()函数 检查当前是否有键盘输入,若有则返回一个非0值,否则返回0

{

char in;

while(!kbhit()==0)  //如果玩家输入了多个按键,以最后一个按键为准

in=getch();

switch(in)

{

case 'w':

case 'W':

if(direction!=DOWN)         //防止缩头

direction=UP;

break;

case 's':

case 'S':

if(direction!=UP)

direction=DOWN;

break;

case 'a':

case 'A':

if(direction!=RIGHT)

direction=LEFT;

break;

case 'd':

case 'D':

if(direction!=LEFT)

direction=RIGHT;

break;

case 'p':

case 'P':

gotoxy(X,0);      

system("pause");

gotoxy(X,0);

printf("                   ");  // 消去下面的按任意键继续

break;

}

}

}

int check(int ii,int jj){// 检查是否能投放食物

if(map_0[ii][jj]==1)

return 0;

if(ii==0 || jj==0 || ii==X-1 || jj==Y-1)

return 0;

int i;

for(i=0;i<Slength;i++){

if(ii==Snake[i][0] && jj==Snake[i][1])

return 0;

}

return 1;

}

void putfood()

{

int i,j;

do{

i=rand()%X;

j=rand()%Y;

}while(check(i,j)==0);

map_0[i][j]=-1;

gotoxy(i,j);

printf("$");

}

bool gameover()

{

bool isgameover=false;

int sX,sY;

sX=Snake[0][0],sY=Snake[0][1];

if(sX==0 || sX==X-1 || sY==0 || sY==Y-1)

isgameover=true;

int i;

for(i=1;i<Slength;i++){

if(sX==Snake[i][0] && sY==Snake[i][1])

isgameover=true;

}

return isgameover;

}

void dy_fs()

{

gotoxy(X,0);

printf("(c)Geek------2018122");

gotoxy(X+1,0);

printf("最终得分: %d",score);

}

管庆帆c/c++大师

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9771207.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存