zoukankan      html  css  js  c++  java
  • dos系统下的游戏~ 不断更新中

    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <set>
    #include <vector>
    #include <sstream>
    #include <queue>
    #include <typeinfo>
    #include <fstream>
    #include <map>
    #include <stdlib.h>
    #include<conio.h>
    typedef long long ll;
    using namespace std;
    //freopen("D.in","r",stdin);
    //freopen("D.out","w",stdout);
    #define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
    #define maxn 100001
    #define eps 1e-9
    #include <windows.h>
    int system(const char *string);
    //system("CLS");
    const int inf=0x7fffffff;   //无限大
    int key;
    string s;
    char c;
    int flag=1;
    struct people
    {
        string name;
        int handsome;
        int max_hp;
        int now_hp;
        int attack;
        int defence;
        int speed;
        int money;
        int good_hushi=0;
        string wife;
    };
    
    struct monster
    {
        string name;
        int max_hp;
        int now_hp;
        int attack;
        int speed;
        int defence;
    };
    monster shilaimu;
    struct time1
    {
        int year;
        int month;
        int day;
    };
    time1 now;
    people hero;
    
    //pk
    void pk(monster a)
    {
        void meun();
        void hospital();
        system("CLS");
        Sleep(1000);
        printf("你在探险的时候遇上了");
        cout<<a.name<<endl;
        Sleep(1000);
        for(int i=0;;i++)
        {
            if(i%(1000-hero.speed)==0)
            {
                int miss=rand()%100;
                if(miss<30)
                {
                    cout<<hero.name<<""<<a.name<<"使用了友颜破山拳!"<<endl;
                    cout<<a.name<<"受到了"<<hero.attack+3-a.defence<<"的伤害"<<endl;
                    a.now_hp=max(0,a.now_hp-hero.attack-3+a.defence);
                    if(a.now_hp==0)
                        break;
                    cout<<a.name<<"还有"<<a.now_hp<<"的生命值"<<endl;
                    printf("
    
    
    
    ");
                    Sleep(2000);
                }
                else if(miss>90)
                {
                    cout<<a.name<<"灵巧的闪避了"<<hero.name<<"的花拳绣腿"<<endl;
                    printf("
    
    
    ");
                    Sleep(2000);
                }
                else
                {
                    cout<<hero.name<<""<<a.name<<"使用了冲锋脚!"<<endl;
                    cout<<a.name<<"受到了"<<hero.attack-a.defence<<"的伤害"<<endl;
                    a.now_hp=max(0,a.now_hp-hero.attack+a.defence);
                    if(a.now_hp==0)
                        break;
                    cout<<a.name<<"还有"<<a.now_hp<<"的生命值"<<endl;
                    printf("
    
    
    
    ");
                    Sleep(2000);
                }
            }
            if(i%(1000-a.speed)==0)
            {
                cout<<a.name<<""<<hero.name<<"摸了一下"<<endl;
                int shanghai=max(0,a.attack-hero.defence);
                cout<<hero.name<<"受到了"<<shanghai<<"的伤害"<<endl;
                hero.now_hp=max(0,hero.now_hp-shanghai);
                if(hero.now_hp==0)
                    hospital();
                cout<<hero.name<<"还有"<<hero.now_hp<<"的生命值"<<endl;
                printf("
    
    
    ");
                Sleep(2000);
            }
        }
        printf("哇,打败了");
        cout<<a.name<<endl;
        printf(",简直全身舒畅!
    ");
        hero.attack++;
        hero.speed++;
        hero.defence++;
        Sleep(1000);
        printf("好累呀,我还是回去睡觉吧
    
    
    
    ");
        Sleep(2000);
        meun();
    }
    
    //#-2
    void begin0()
    {
        shilaimu.name="史莱姆";
        shilaimu.max_hp=10;
        shilaimu.now_hp=10;
        shilaimu.attack=3;
        shilaimu.defence=1;
        shilaimu.speed=1;
    }
    
    //#-1
    int start01()
    {
        int flag1=1;
        system("CLS");
        Sleep(1000);
        printf("你确定要开始这个游戏吗?(Y/N)
    ");
        now.year=2015;
        now.month=9;
        now.day=1;
        while(1)
        {
            key=getch();
            if(key=='N'||key=='n')
            {
                flag1=0;
                break;
            }
            if(key=='Y'||key=='y')
                break;
            printf("你是傻逼吗?叫你输入Y/N
    请重新输入(Y/N)
    ");
        }
        return flag1;
    }
    //#0
    void start0()
    {
        Sleep(1000);
        printf("你叫什么名字?(请输入你的名字)
    ");
        int flag=1;
        while(1){
            cin>>hero.name;
            printf("哦,你的名字是");
            cout<<hero.name<<""<<endl;
            Sleep(1000);
            printf("你确定吗?(Y/N)
    ");
            while(1)
            {
                key=getch();
                if(key=='N'||key=='n')
                {
                    break;
                }
                if(key=='Y'||key=='y')
                {
                    flag=0;
                    break;
                }
                printf("你是傻逼吗?
    请重新输入(Y/N)
    ");
            }
            if(flag==0)
                break;
            printf("那就再输入你的名字吧
    ");
        }
        hero.handsome=50;
        hero.max_hp=50;
        hero.now_hp=50;
        hero.attack=3;
        hero.defence=0;
        hero.speed=1;
        hero.money=50;
        hero.wife="0";
    }
    
    
    //#1
    void start1()
    {
        key=0;
        system("CLS");
        Sleep(2000);
        printf("呼,到了,这里就是梦寐以求的大学了。
    ");
        Sleep(1000);
        printf("已经准备好度过接下来的四年大学时光了!
    
    
    
    ");
        Sleep(1000);
        printf("(按C键继续)
    ");
        while(1){
            key=getch();
            if(key=='C'||key=='c')
            {
                break;
            }
            else
            {
                Sleep(1000);
                printf("你是傻逼吗?叫你按C
    ");
            }
        }
    }
    //#2_first_chose
    void start2()
    {
        key=0;
        system("CLS");
        Sleep(2000);
        printf("其实,当初填报志愿之所以会选择这所学校,还有一个特殊的原因的……
    
    
    
    
    ");
        Sleep(2000);
        printf("1.这所学校是曾经单相思的男生的第一志愿
    ");
        printf("2.这所学校的哲学气息浓厚
    ");
        printf("3.这所学校拥有良好的校风和环境
    ");
        printf("4.这所学校有愉快的社团文化
    
    
    ");
        Sleep(1000);
        printf("请输入1234进行选择
    
    ");
        while(1)
        {
            key=getch();
            if(key=='1')
            {
                hero.max_hp+=10;
                printf("没错,我");
                cout<<hero.name;
                printf("是个基佬……
    ");
                Sleep(3000);
                break;
            }
            if(key=='2')
            {
                hero.attack+=1;
                printf("没错,我是个基佬……
    
    ");
                Sleep(1000);
                printf("而这所学校,则是拥有深厚的哲♂学底蕴的学校!!
    ");
                Sleep(1000);
                printf("毕竟男女比例7:1
    
    ");
                Sleep(3000);
                break;
            }
            if(key=='3')
            {
                hero.defence+=1;
                printf("
    
    毕竟是一所理工科学校,哥是来学习的,绝逼不会搞基的!
    ");
                Sleep(3000);
                break;
            }
            if(key=='4')
            {
                hero.speed+=1;
                printf("
    
    蛤蛤,动漫社我来了!!!
    ");
                Sleep(1000);
                printf("
    听说这所学校有很多萌妹子!
    
    ");
                Sleep(1000);
                printf("
    不过这所学校男女比例是1:7……
    ");
                break;
            }
            Sleep(1000);
            printf("你是傻逼吗?叫你输入1234,你怎么这个都看不懂啊,菜鸡
    ");
    
            Sleep(3000);
        }
    }
    void check()
    {
        void meun();
        key=0;
        system("CLS");
        Sleep(2000);
        printf("你的名字:");
        cout<<hero.name<<endl;
        printf("你的魅力值:");
        cout<<hero.handsome<<endl;
        printf("你的生命值:");
        cout<<hero.now_hp<<"/";
        cout<<hero.max_hp<<endl;
        printf("你的攻击力:");
        cout<<hero.attack<<endl;
        printf("你的防御力:");
        cout<<hero.defence<<endl;
        printf("你的敏捷值:");
        cout<<hero.speed<<endl;
        printf("你的金钱数: ");
        cout<<hero.money<<endl;
        printf("你的配偶:");
        if(hero.wife=="0")
            printf("有个球配偶啊!
    ");
        else
            cout<<hero.wife<<endl;
    
        Sleep(3000);
        printf("
    
    
    
    
    ");
        printf("按B键,回到主菜单
    ");
        while(1){
            key=getch();
            if(key=='B'||key=='b')
            {
                break;
            }
            else
            {
                Sleep(1000);
                printf("你是傻逼吗?叫你按B
    ");
            }
        }
        meun();
    }
    void meun()
    {
        void hospital();
        void tanxian();
        void gotoschool();
        void shop();
        key=0;
        system("CLS");
        Sleep(2000);
        if(now.day>30)
        {
            now.month++;
            now.day-=30;
            if(now.month>12)
            {
                now.month-=12;
                now.year+=1;
            }
        }
        cout<<"现在是"<<now.year<<""<<now.month<<""<<now.day<<""<<endl;
        printf("呼呼,你现在想干什么呢?
    
    
    
    ");
        Sleep(1000);
        printf("1.查看自己属性
    ");
        printf("2.探险
    ");
        printf("3.上课
    ");
        printf("4.去超市逛逛
    ");
        printf("5.校医院
    ");
        printf("
    
    
    
    请输入12345进行选择
    ");
        while(1)
        {
            key=getch();
            if(key=='1')
            {
                check();
                break;
            }
            if(key=='2')
            {
                tanxian();
                break;
            }
            if(key=='3')
            {
                gotoschool();
                break;
            }
            if(key=='4')
            {
                shop();
                break;
            }
            if(key=='5')
            {
                hospital();
                break;
            }
            Sleep(3000);
            printf("叫你这个傻逼输入1234,你怎么就是不懂啊,你怎么这么菜鸡啊
    
    
    ");
            Sleep(1000);
            printf("再给你个机会,输入1/2/3/4吧!
    
    ");
        }
    }
    void bed_end()
    {
        printf("胜败乃兵家常事,大侠还请重新来过
    
    
    
    ");
        Sleep(3000);
        printf("(按C键重新游戏)
    ");
        while(1){
            key=getch();
            if(key=='C'||key=='c')
            {
                break;
            }
            else
            {
                Sleep(1000);
                printf("你是傻逼吗?叫你按C
    ");
            }
        }
    }
    
    void tanxian()
    {
        key=0;
        system("CLS");
        printf("今天去哪儿呢?
    
    
    
    ");
        int kiss=rand()%100;
        if(kiss<30)
        {
            Sleep(1000);
            pk(shilaimu);
        }
        else
        {
            Sleep(2000);
            printf("什么都没有发生诶!");
            Sleep(2000);
            now.day++;
            meun();
        }
        Sleep(3000);
        printf("今天就去后山吧!!
    ");
        Sleep(2000);
        printf("惨了,遇到石头人了……
    ");
        Sleep(2000);
        printf("我要挂了……怎么办
    ");
        Sleep(2000);
        printf("呃!!!%…我挂了%……
    
    
    ");
        Sleep(3000);
        bed_end();
    }
    
    void gotoschool()
    {
        key=0;
        system("CLS");
        Sleep(3000);
        printf("好无聊……
    
    
    ");
        Sleep(3000);
        printf("早知道,就不来上课的
    
    
    ");
        Sleep(3000);
        meun();
    }
    
    void shop()
    {
        key=0;
        system("CLS");
        if(hero.money<100)
        {
            printf("这么点钱也想来高贵的校园超市?给我滚。
    
    
    
    ");
            Sleep(3000);
            meun();
        }
    }
    
    void meun1()
    {
        key=0;
        system("CLS");
        Sleep(2000);
        printf("呼呼,终于进来了这个学校了,你现在想干什么呢?
    
    
    
    ");
        Sleep(1000);
        printf("1.查看自己属性
    ");
        printf("2.探险
    ");
        printf("3.上课
    ");
        printf("4.去超市逛逛
    ");
        while(1)
        {
            key=getch();
            if(key=='1')
            {
                check();
                break;
            }
            if(key=='2')
            {
                tanxian();
                break;
            }
            if(key=='3')
            {
                gotoschool();
                break;
            }
            if(key=='4')
            {
                shop();
                break;
            }
            Sleep(3000);
            printf("叫你这个傻逼输入1234,你怎么就是不懂啊,你怎么这么菜鸡啊
    
    
    ");
            Sleep(1000);
            printf("再给你个机会,输入1/2/3/4吧!
    
    ");
        }
    }
    
    void hospital()
    {
        void meun();
        system("CLS");
        if(hero.now_hp==0)
        {
            printf("护士姐姐:咦,这位小哥,怎么快挂了……
    ");
            printf("好好休息一下吧
    
    ");
            Sleep(1000);
            printf("于是,就这样,浑浑噩噩的睡过了两天
    
    ");
            Sleep(2000);
            printf("不过好像,护士姐姐对你的好感度增加了诶.");
            hero.good_hushi+=2;
            now.day+=2;
            meun();
        }
        else
        {
            Sleep(2000);
            printf("护士姐姐:这位小哥,是来看病吗?(Y/N)
    
    
    ");
            key=0;
            while(1){
            key=getch();
            if(key=='y'||key=='Y')
            {
                printf("护士姐姐:~(≧▽≦)/~好呀好呀,你就睡一觉吧!
    
    ");
                Sleep(2000);
                printf("于是,你就睡了一觉,让自己精力充沛了起来
    
    ");
                Sleep(2000);
                printf("不过,护士姐姐貌似挺可爱的!
    ");
                hero.good_hushi+=1;
                now.day+=1;
                hero.now_hp=hero.max_hp;
                Sleep(3000);
                meun();
            }
            else if(key=='n'||key=='N')
            {
                printf("护士姐姐:那你滚吧!滚回去和基友玩蛋去!");
                Sleep(3000);
                meun();
            }
            printf("叫你按y/n呀,你又调皮,护士姐姐对你的好感度降低了!");
            }
        }
    }
    
    int main()
    {
        srand( (unsigned)time( NULL ) );
        if(start01()==1)
        while(1)
        {
            begin0();
            key=0;
            system("CLS");
            start0();
            start1();
            start2();
            meun1();
        }
        return 0;
    }
  • 相关阅读:
    asp.net mvc 三层加EF两表联查
    asp.net mvc 三层加EF 登录注册 增删改查
    超市管理系统
    asp.net三层架构增删改查
    ACCP8.0 HTML标签
    Sql 优化解决方案
    抽象类与抽象方法
    Form 表单提交的几种方式
    C# 接口的使用(工厂模式)
    使用VBA设置打印页面高度和宽度
  • 原文地址:https://www.cnblogs.com/qscqesze/p/4276792.html
Copyright © 2011-2022 走看看