C++ 制作 高效的游戏机 ,只剩《2000》行了 ,代码奉上

1,C++ 是什么?

         

C++ 就是 C++,不要问我为什么

知道了c++是什么,接下来就该执行代码了

2,如何制作游戏?

需要使得游戏内容更加丰富,逻辑更加得体,玩法更加具有更随时代的特点 就需要动动你快乐的大脑!!!!!!

仅有一副空壳是不够的,对于游戏来说。那么如何进一步精益求精

3,未曾设想的道路

他就是   system----------------------

    1,system("start ~~~"); 表示打开网址    例:system("start www.4399.com");
	2,system("calc");      表示打开计算器  
	3,system("pause"); 	表示在调试框执行“停” 
	4,system("title ~~~"); 表示切换窗口名  例:system("title 我的程序");
	5,system("shutdown");  表示关机/重启   例:system("shutdown -r -t 2");
	6,system("cls");       表示清屏    
	7,system("mode con cols=~~ lines=~~"); 表示调整调试创大小 例:system("mode con cols=77 
lines=33");
	8,system("sndrec32");  表示录音(存在缺陷)   

接下来,就是代码

//#include<bits/stdc++.h>
#include<iostream>//全能版上半段
#include<Windows.h>
#include<conio.h> 
#include<cstring>
#include<cstdio>
#include<ctime>
//#include<time.h>
//#include"cmath" 
//#define IsKeyDown(VK_NAME) ((GetAsyncKeyState(VK_NAME) & 0x8000) ? true:false) 
#define mm2 1200
#define mm1 700
#define mm3 1900
#define ctl 857
#define mop 10000
#define m1 560
#define m2 660
#define m3 760
#define m4 870
#define m5 1000
#define m6 1140
#define m7 1290
#define m8 1450
#define m9 1610
#define m10 1770
#define m11 1930
#define m12 2090
#define m13 2250
#define m14 2400
#define m15 2550
using namespace std;
string xiaotishi[200]={"","首先是活下来,再考虑别的","日出而作,日落而息","食用鱼类可获得不同的增益","",""}; 
void ftl()
{
    cout<<"你一定要活下去!\n";
}
int vf(int x,int t){
    if(x==t/2-1){return t/2+t/2-t;}
    else{return 100;}
}
long long f(long long xx,long long yx,long long zx)
{
    long long cnt=1;string ddt="不合法算式"; 
    if(zx==4&&yx==0){cout<<ddt;return 0;} 
    if(zx==1)
    {return xx+yx;}
    if(zx==2)
    {return xx-yx;}
    if(zx==3)
    {return xx*yx;}
    if(zx==4)
    {return xx/yx;}
    if(zx==5)
    {return xx%yx;}
    if(zx==6)
    {       
        if(abs(xx-yx)>45)
        {
            return 0;
        }
        for(int i=min(xx,yx);i<=max(xx,yx);i++)
        {
            cnt*=i;
        }
        return cnt;
    }
    if(zx==7)
    {
        for(int i=1;i<=yx;i++)
        {
            cnt*=xx;
        }return cnt;
    }
}
string sz[859]={"","+","-","x","除以","%","!","的_次方"};
int ttle(int fffa)
{
    fffa-=1;
    return fffa;
}  
void battle(int cishu)
{
    system("cls");Sleep(555);
    for(int i=1;i<=cishu;i++)
    {
        cout<<"     ......."<<endl;
        cout<<"   .......貝.."<<endl;
        cout<<"  ............"<<endl;
        cout<<"  ............."<<endl;
        cout<<"   ..........."<<endl;               
        cout<<"    ......."<<endl;
        cout<<"    ....."<<endl;
        cout<<"    ...."<<endl;
        cout<<"   ................................"<<endl;
        cout<<"   ..............."<<endl;
        cout<<"   ......................................"<<endl;
        cout<<"   ..."<<endl;
        cout<<"   ..."<<endl;
        cout<<"   .................."<<endl;
        cout<<"   .... .           ."<<endl;
        cout<<"   .............    ."<<endl;
        cout<<"              .    ."<<endl;
        cout<<"              .    ."<<endl;
        cout<<"             .    ."<<endl;
        cout<<"             .    ."<<endl;
        cout<<"             .    ."<<endl;
        cout<<"             ...  ..."<<endl;
        Sleep(62);system("cls");
        cout<<"       ......."<<endl;
        cout<<"     ......貝貝。"<<endl;
        cout<<"   ............."<<endl;
        cout<<"   ............."<<endl;
        cout<<"   ..........."<<endl;               
        cout<<"    ......."<<endl;
        cout<<"    ...."<<endl;
        cout<<"    ...                      "<<endl;
        cout<<"   ...            ......."<<endl;
        cout<<"   ................"<<endl;
        cout<<"   .............    ..........."<<endl;
        cout<<"   ................................"<<endl;              
        cout<<"   ..."<<endl;
        cout<<"   ..."<<endl;
        cout<<"   ..................."<<endl;
        cout<<"   .... ..           ."<<endl;
        cout<<"   .    ....          ."<<endl;
        cout<<"   .....    ....     .                "<<endl;
        cout<<"               .    . "<<endl;
        cout<<"              .    ."<<endl;
        cout<<"            .    ."<<endl;
        cout<<"           .   ."<<endl;
        cout<<"          .   ."<<endl;
        cout<<"        .   ."<<endl;
        cout<<"      ...  ..."<<endl;
        Sleep(62);system("cls");
    }
    Sleep(200);
    system("cls");
}
void gettime()
{
    time_t rawtime;
    struct tm *ptminfo;
    time(&rawtime);
    ptminfo = localtime(&rawtime);
    printf(": %02d-%02d-%02d %02d:%02d:%02d(鸡霓太美)",
    ptminfo->tm_year + 1900, ptminfo->tm_mon + 1, ptminfo->tm_mday,
    ptminfo->tm_hour, ptminfo->tm_min, ptminfo->tm_sec);
}
void zairu()//组件,自己找地加入貝 
{
    int bl=70;//变量貝 
    int righl=0;
    for(int i=1;i<=20;i++)
    {
        if(xiaotishi[i]!=""){righl+=1;}
    }
    srand((int)time(0));
    int tim=rand()%righl+1;
    system("cls");
    for(int i=1;i<=bl+4;i+=1){
        int timett=2+(int)(25.0 * rand()/(RAND_MAX+1.0));
        if(i==bl+1){
            cout<<"                                                      \n";
            cout<<"                                                      \n";
            cout<<"                                                     \n";
            cout<<"                                 (\\                               \n";
            cout<<"                                /  \\                             \n";
            cout<<"                               /    |                             \n";
            cout<<"                              /     |                             \n";
            cout<<"                              |     \\                             \n";
            cout<<"                              /      \\                            \n";
            cout<<"                             |________|____________                  \n";
            cout<<"                             |        |                       \n";
            cout<<"                              \\      /                        \n";
            cout<<"                              |     /                         \n";
            cout<<"                              \\     |                         \n";
            cout<<"                               \\    |                         \n";
            cout<<"                                \\  /                          \n";
            cout<<"                                 (/                           \n";
            cout<<"                                                             \n";Sleep(300);   system("cls");continue;     
        }else if(i==bl+2){
            cout<<"                                                      \n";
            cout<<"                                                      \n";
            cout<<"                                                   \n";
            cout<<"                                 (\\                               \n";
            cout<<"                               /   \\                             \n";
            cout<<"                              /     |                             \n";
            cout<<"                             /      |                             \n";
            cout<<"                            /       \\                             \n";
            cout<<"                           /         \\                            \n";
            cout<<"                          [___________|___________                  \n";
            cout<<"                           \\          |                       \n";
            cout<<"                            \\        /                        \n";
            cout<<"                             \\      /                         \n";
            cout<<"                              \\     |                         \n";
            cout<<"                               \\    |                         \n";
            cout<<"                                \\  /                          \n";
            cout<<"                                 (/                           \n";
            cout<<"                                                             \n";      
            Sleep(300);system("cls");   continue;
        }
        else if(i==bl+3){
            cout<<"                                                      \n";
            cout<<"                                                      \n";
            cout<<"                                                     \n";
            cout<<"                                (\\                               \n";
            cout<<"                               /   \\                             \n";
            cout<<"                             /      |                             \n";
            cout<<"                           /        |                             \n";
            cout<<"                         /          \\                             \n";
            cout<<"                        /            \\                            \n";
            cout<<"                      [_______________|_____                  \n";
            cout<<"                      |               |                       \n";
            cout<<"                        \\            /                        \n";
            cout<<"                         \\          /                         \n";
            cout<<"                           \\        |                         \n";
            cout<<"                             \\      |                         \n";
            cout<<"                               \\   /                          \n";
            cout<<"                                (/                           \n";
            cout<<"                                                            \n";   Sleep(350);system("cls");   continue;
        }
        else if(i==bl+4){
        cout<<"                                                      \n";
        cout<<"                                                      \n";
        cout<<"                                                    \n";
        cout<<"                                     (\\                               \n";
        cout<<"                                     | \\                             \n";
        cout<<"                                     |  |                             \n";
        cout<<"                                     |  |                             \n";
        cout<<"                                     |  \\                             \n";
        cout<<"                                     |   \\                            \n";
        cout<<"                                     |    |             -          -\n";
        cout<<"                                     |    |                                         -             -\n";
        cout<<"                                     |   /                      -             -     \n";
        cout<<"                                     |  /                         \n";
        cout<<"                                     |  |                         \n";
        cout<<"                                     |  |                         \n";
        cout<<"                                     | /                          \n";
        cout<<"                                     (/                           \n";
        cout<<"                                                             \n";Sleep(450);system("cls"); continue;       
        }
        else{
        cout<<"                                                      \n\n";
        cout<<"                             正  在  加  载  中...                            \n\n";
        cout<<"                                    (\\                               \n";
        cout<<"                                    | \\                             \n";
        cout<<"                                    |  |                             \n";
        cout<<"                                    |  |                             \n";
        cout<<"                                    |  \\                             \n";
        cout<<"                                    |   \\                            \n";
        cout<<"                                    |____|__________________                        \n";
        cout<<"                                    |    |                            \n";
        cout<<"                                    |   /                            \n";
        cout<<"                                    |  /                         \n";
        cout<<"                                    |  |                         \n";
        cout<<"                                    |  |                         \n";
        cout<<"                                    | /                          \n";
        cout<<"                                    (/                           \n\n";            
        }
        cout<<"       ";for(int iff=1;iff<=bl;iff++){cout<<"_";}cout<<"\n";
        cout<<"      |";for(int j=1;j<=i;j++){cout<<"▇";}for(int k=1;k<=bl-i;k++){cout<<" ";}cout<<" |\n";
        cout<<"       ";for(int itt=1;itt<=bl;itt++){cout<<"▔";}cout<<"\n";
        cout<<"                                     "<<i*100/bl<<"%                 \n";
        cout<<"                        小提示:"<<xiaotishi[tim];
        Sleep(timett);
        system("cls");
    }Sleep(400);
}
const long long MAXN=10000000000;
int fishjez[30]={0,80,40,60,90,100,85,55,75,25,25,40,60,50,45,130,70};
string cfnm[25]={"","烤肉","烤鱼","荒野烤肉","烤土豆","肉汤","土豆泥","秘制炖肉","","","","",""};
int cfjez[25]={0,95,80,130,105,155,135,200}; 
string gjfxx[30]={"","獠牙","利爪","笙忼术","笙电术","土玄术","战斧","法杖","易闽术","鸡汤术","篮球","易慴术","戟埕术","黑子"};
string fishing[200]={"","石斑鱼","螃蟹","条石斑","鲭鱼","鲶鱼","红鳟鱼","海鲂","小鲨鱼","海参","鳐鱼","沙丁鱼","鳕鱼","蝴蝶鱼","章鱼","秋刀鱼","罗非鱼","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};
string fms[8]={"","I","II","III","IV","V"};
string dfs1[20]={"","","",""}; 
struct o{
    int times;
    int jjes;
}fishs[1000]; 
struct sc{
    int ts;
    int js;
}cfs[505];
struct wqc{
	string mz;//枪名 
	int shh;//伤害 
	int shecheng;//射程 
	int sl;//枪数 
}wqs[1005];
int top=0;
void gun(string sppp,int shhhh,int shee)
{
	int cati=0;
	top++;
	for(int i=1;i<=top;i++)
	{
		if(sppp==wqs[i].mz )
		{
			wqs[i].sl ++;cati=1;break;
		} 
	}
	if(cati==0)
	{
		wqs[top].mz =sppp;
		wqs[top].shecheng =shee;
		wqs[top].sl ++;
		wqs[top].shh =shhhh;
	}
	else
	{
		top--;
	}
}
int main(){ for(int i=1;i<=7;i++){cfs[i].js =cfjez[i];} 
system("title 快乐游戏机");
for(int i=1;i<=14;i+=1){fishs[i].jjes =fishjez[i];}string gjfx;int ttk=0;
char a1[100][100]={
"################################### ",
"#!             #    *#            # ",
"######      #####   #####    ###### ",
"#                               * # ",
"#####  ##########   ########  ##### ",
"#   ##        *#  #  #       ##   # ",
"#     ###      #  #  #    ###     # ",
"# ####   ########   ######   #### # ",
"#               ## ##             # ",
"#    #########        ########    # ",
"#             ##    ##  @         # ",
"############    ####    ########### ",
"#           ##        ##          # ",
"### ##        ###  ###       ###  # ",
"#*   #                       #@   # ",
"################################### ",
"                                    ",
};
char a2[100][100]={
"################################### ",
"#!       ###                      # ",
"#######     ###      ########     # ",
"#      ###     ###       *  #     # ",
"#         ###     ###########     # ",
"#   ######   ###                  # ",
"#        #      ################  # ",
"#   ###  #                        # ",
"#   # *  #         ################ ",
"#   ######      ### *#            # ",
"#            ###      #####       # ",
"#         ###        #     #      # ",
"#      ###          #   #   #   @ # ",
"#   ###      ########   #   #     # ",
"#                       #         # ",
"################################### ",
"                                    ",
};
char a3[100][100]={
"################################### ",
"# @   #####    #   #              # ",
"#  # # &#   #  #   #   # &  #     # ",
"#   #   # ##   #   #   #   *#     # ",
"#       ##    ##   ##  ######     # ",
"#    &  #    #  # #  #            # ",
"################# ################# ",
"#                !                # ",
"################# ################# ",
"#            #  # #  #*           # ",
"#           # ##   ##     # #     # ",
"#  *     ###   #   #@    #   #    # ",
"#     ###      #   #    #  &  #   # ",
"#####          #   #  ########### # ",
"#&  ########   #   #     @        # ",
"################################### ",
"                                    ",
};
char a4[100][100]={
"################################### ",
"#              #   #        *     # ",
"#    ######   #  !  #   ######    # ",
"#          ###       ###          # ",
"#######       ##   ##       ####### ",
"#  *   ##       # #       ##      # ",
"#    ##    ###### #####     ##    # ",
"#  ##    ##            ##     ##  # ",
"#      ##     ##   ##    ##       # ",
"#   ###  @   #  ###  # *    ###   # ",
"# ##*  ##                 ##   ## # ",
"# #      ##    #   #    ##      # # ",
"#          #   #   #   #    @     # ",
"#        #######   #######        # ",
"#                                 # ",
"################################### ",
"                                    ",
};
char a5[100][100]={
"################################### ",
"#!                               *# ",
"#        ####    ###         ###### ",
"#########       #   #####         # ",
"# @            #         ####     # ",
"#######      ##   ######  #  ###  # ",
"#         ###         *#  #    #  # ",
"#      ###  #     ######   #   #  # ",
"#   ###  #     ###         #   #  # ",
"#    #      ###      ###   #   #  # ",
"####     ###      ###  #   #   #  # ",
"#   #####     ####     #  #    #  # ",
"#          ###         #  #    #  # ",
"#     #####    ###########   ###  ##",
"#  ###       ##  @           #     #",
"####################################",
"                                    ",
};
char picture6[200][100]={
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                            ___                   ",
"                           /   \\                           ",
"                          /     \\        ",
"                         /       \\             ",
"                        /         \\                      ",
"                       /           \\                     ",
"                      /      _      \\        ",
"                      |     |_|     |      ",
"                      |             |                  ",
"                      |             |          ",
"                      |      _      |                  ",
"                      |     |_|     |                   ",
"                      |             |                   ",
"                      |             |    ",
"                      |      _      |                   ",
"                      |     |_|     |                   ",
"                     /|             |\\                   ",
"                    / |             | \\                ",
"                   /  |      _      |  \\                  ",
"                  /   |     |_|     |   \\                    ",
"                 /    |             |    \\                 ",
"                /     |             |     \\               ",
"               /      |      _      |      \\                  ",
"               |      |     |_|     |      |                  ",
"               |      |             |      |              ",
"               |_____/|             |\\_____|              ",                               
"                 |_|  |             |  |_|                 ",   
"                 /|\\  |             |  /|\\                  ",
"                      |             |                   ",
"                     /               \\                  ",
"                    /                 \\                 ",
"                   /___________________\\               ",
"                      |  |      |  |                     ",
"                      |__|      |__|                       ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
"                                                      ",
&#
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
五子棋是一种非常受欢迎的棋类游戏,它的规则相对简单,但是实现一个完整的五子棋游戏代码需要大约400。以下是一种可能的实现方式: 首先,我们需要一个棋盘来存储棋子的位置。可以使用一个二维数组来表示,数组的大小为15x15,表示1515列的棋盘。每个位置可以用0表示空位,用1表示黑子,用2表示白子。 接下来,我们需要实现游戏的逻辑。首先是轮流下棋的功能,可以使用一个变量来表示当前是哪种颜色的棋子,例如黑子为1,白子为2。每次轮到某个玩家下棋时,根据鼠标点击的位置来确定下棋的位置,然后将对应的数组位置设置为当前玩家的颜色。 然后,我们需要实现判断胜负的功能。五子棋的胜负判断比较简单,只需要判断是否有任意一方连成了5个棋子即可。可以使用循环来遍历整个棋盘,判断每个位置上的棋子与其周围8个位置上的棋子是否连成了5个。 除了这些基本功能外,还可以加入一些其他的功能,如悔棋、重新开始等。悔棋功能可以记录下每一步下棋的位置,然后通过撤销上一步棋来实现悔棋功能。重新开始功能可以通过重新初始化棋盘来实现。 综上所述,一个简单的五子棋游戏代码大约需要400左右。但是实际上,代码数可能会根据具体的实现方式和功能需求有所不同。这里只是给出了一个大致的估计。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值