自创程序 NBA-OFFICE来啦!

苦肝两年半,终于也是第一时间问世了!

至于怎么用这个程序,大家想咋用咋用呗~

但愿这篇可以获得很多赞赞~

话不多说,上代码!

#include<bits/stdc++.h>
#include<conio.h>
#include<ctime>
#include<windows.h>
#define endl "\n"
using namespace std;
const string ID="1234567";
string id;
const string PSW="1234567";
string psw;
double shanghai[20]={0.6,1.1,2,3.16,5.5,7,10,20,50,100,146.23,254.13,312,403,601,1023};
double bosshealth[20]={2,3,4,5.9,8,14,19,32,73,157,200,403,801,1200,3630,20123};
double wj_shanghai=1,wj_health=10,wj_max_health=10,boss,wj_money;
void chushihua();
void game();
void gongji();
void goumai();
void shangdian();
void zhujiemian();
void fangyu();
void cend();
void chushou();
void print(char[]);
void color_print();
int bishou=0,caidao=0,jian=0,shenjian=0;
double bishou_1=5,caidao_1=17,jian_1=58,shenjian_1=123.1;
int hat=0,douhui=0,hudun=0,hunjia=0,shendun=0;
double hat_1=7,douhui_1=21,hudun_1=49,hunjia_1=89,shendun_1=210.4;
void cls() {
    system("cls");
}
void cend()
{
    system("cls");
    print("GAME OVER");
    return;
}
void game()
{
    int k;
    chushihua();
    IO:
    printf("请输入对手等级 (0~15)\n");
    scanf("%d",&k);
    if(k>15||k<0)
    {
        system("cls");
        goto IO;
    }
    boss=bosshealth[k];
    system("cls");
    while(wj_health>=0)
    {
        srand(time(NULL));
        QP:
        printf("1.逃跑        2.进攻\n");
        char s=getch();
        if(s<'1'||s>'2')
        {
            system("cls");
            goto QP;
        }
        if(s=='1')
        {
            system("cls");
            zhujiemian();
        }
        system("cls");
        double l=shanghai[k]*((rand()%2)+1)+fabs(double(rand()%100/100-2));
        printf("对手对你造成了%lf点伤害\n",l);
        wj_health-=l;
        printf("你当前剩余血量:%lf\n",wj_health);
        if(wj_health<=0)
            cend();
        double o=wj_shanghai*((rand()%2)+1)+double(rand()%10/10);
        boss-=o;
        printf("你对对手造成了%lf点伤害\n",o);
        printf("对手当前剩余血量:%lf\n\n",boss);
        if(boss<=0)
        {
            printf("胜利!\n获得%lf金币\n\n当前剩余血量:%lf\n",shanghai[k]+3,wj_health);
            wj_money+=shanghai[k]+3;
            printf("\n余额:%lf\n",wj_money);
            getch();
            if(k==15)
            {
                printf("恭喜玩家!游戏胜利!\n");
                getch();
                exit(1);
            }
            system("cls");
            zhujiemian();
        }
    }
}
void zhujiemian()
{
    PO:
    printf("1.商店 2.战斗 3.回血 4.状态\n");
    char k=getch();
    if(k=='1')
    {
        system("cls");
        shangdian();
        return;
    }
    if(k=='2')
    {
        system("cls");
        game();
        return;
    }
    if(k=='3')
    {
        system("cls");
        if(wj_money>0)
        {
            wj_money=wj_money*4/5-1;
            chushihua();
            wj_health=wj_max_health;
            printf("回血成功!\n");
            getch();
            system("cls");
            goto PO;
        }
        else
        {
            printf("余额不足!\n");
            getch();
            system("cls");
            goto PO;
        }
    }
    if(k=='4')
    {
        chushihua(); 
        system("cls");
        printf("生命值:%lf\n",wj_health);
        printf("最大生命值:%lf\n",wj_max_health);
        printf("攻击力:%lf\n",wj_shanghai);
        printf("金币:%lf\n",wj_money); 
        getch();
        system("cls");
        goto PO;
    }
    if(k=='5')
    {
        string a;
        system("cls");
        printf("输入密码!\n");
        cin>>a;
        if(a=="songyudashuaibi"||a=="PI")
        {
            wj_money+=1000;
            printf("外挂生效\n");
            Sleep(1000);
            system("cls");
            goto PO;
        }
        printf("外挂失败\n");
        Sleep(1000);
        system("cls");
        goto PO;
    }
}
void shangdian()
{
    LK:
    printf("1.购买 2.返回主界面\n");
    char k=getch();
    if(k!='1'&&k!='2')
    {
        system("cls");
        goto LK;
    }
    if(k=='1')
    {
        system("cls");
        goumai();
        goto LK;
    }
    if(k=='2')
    {
        system("cls");
        zhujiemian();
        return;
    }
}
void goumai()
{
    ML:
    printf("1.攻击 2.防御 3.返回主界面\n");
    char k=getch();
    if(k!='1'&&k!='2'&&k!='3')
    {
        system("cls");
        goto ML;
    }
    if(k=='1')
    {
        system("cls");
        gongji();
        goto ML;
    }
    if(k=='3')
    {
        system("cls");
        zhujiemian();
        return;
    }
    if(k=='2')
    {
        fangyu();
    }
} 
void gongji()
{
    OP:
    system("cls");
    printf("0.返回上界面\n");
    printf("1.返回主界面\n");
    printf("2.匕首 5金币\n");
    printf("3.菜刀 17金币\n");
    printf("4.剑 68金币\n");
    printf("5.圣剑 210金币\n");
    printf("提醒:金币价格与伤害成正比\n");
    char k=getch();
    if(k<'0'||k>'5')
    {
        system("cls");
        goto OP;
    }
    if(k=='0')
    {
        system("cls");
        goumai();
        return;
    }
    if(k=='1')
    {
        system("cls");
        zhujiemian();
        return;
    }
    if(k=='2')
    {
        if(wj_money>=bishou_1)
        {
            chushihua();
            system("cls");
            wj_money-=bishou_1;
            bishou++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        system("cls");
        goto OP;
    }
    if(k=='3')
    {
        if(wj_money>=caidao_1)
        {
            chushihua();
            system("cls");
            wj_money-=caidao_1;
            caidao++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
    if(k=='4')
    {
        if(wj_money>=jian_1)
        {
            chushihua();
            system("cls");
            wj_money-=jian_1;
            jian++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
    if(k=='5')
    {
        if(wj_money>=shenjian_1)
        {
            chushihua();
            system("cls");
            wj_money-=shenjian_1;
            shenjian++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
}
void fangyu()
{
    OP:
    system("cls");
    printf("0.返回上界面\n");
    printf("1.返回主界面\n");
    printf("2.帽子 7金币\n");
    printf("3.头盔 21金币\n");
    printf("4.护盾 49金币\n");
    printf("5.盔甲 89金币\n");
    printf("6.圣盾 210金币\n");
    printf("提醒:金币价格与伤害成正比\n");
    char k=getch();
    if(k<'0'||k>'6')
    {
        system("cls");
        goto OP;
    }
    if(k=='0')
    {
        system("cls");
        goumai();
        return;
    }
    if(k=='1')
    {
        system("cls");
        zhujiemian();
        return;
    }
    if(k=='2')
    {
        if(wj_money>=hat_1)
        {
            chushihua();
            system("cls");
            wj_money-=hat_1;
            hat++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        system("cls");
        goto OP;
    }
    if(k=='3')
    {
        if(wj_money>=douhui_1)
        {
            chushihua();
            system("cls");
            wj_money-=douhui_1;
            douhui++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
    if(k=='4')
    {
        if(wj_money>=hudun_1)
        {
            chushihua();
            system("cls");
            wj_money-=hudun_1;
            hudun++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
    if(k=='5')
    {
            chushihua();
        if(wj_money>=hunjia_1)
        {
            system("cls");
            wj_money-=hunjia_1;
            hunjia++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
    if(k=='6')
    {
        if(wj_money>=shendun_1)
        {
            chushihua();
            system("cls");
            wj_money-=shendun_1;
            shendun++;
            goto OP;
        }
        system("cls");
        printf("余额不足!\n");
        getch();
        goto OP;
    }
}
void chushihua()
{
    wj_max_health=hat*hat_1+douhui*douhui_1+hudun*hudun_1+hunjia*hunjia_1+shendun*shendun_1+10;
    wj_shanghai=bishou*bishou_1+caidao*caidao_1+jian*jian_1+shenjian*shenjian_1+1;
}
void print(char a[])
{
    int s=strlen(a);
    for(int i=0;i<s;i++)
    {
        cout<<a[i];
        Sleep(400);
    }
    getch(); 
    system("cls");
}
void color_print(int a,int b,int c,string s){
    wprintf(L"\x1b[38;2;%d;%d;%dm",a,b,c);
    cout<<s;
    wprintf(L"\x1b[38;2;%d;%d;%dm",255,255,255);
}
int power(int n) {
    long long s = 1,i = 0;
    while(s < n) {
        s *= 2;
        i++;
    }
    return i;
}
void ccc(string s) {
    for(int i = 0; i < s.size(); i++) {
        cout << s[i];
        Sleep(25);
    }
    cout << "\n";
}
void c_slow(string s) {
    for(int i = 0; i < s.size(); i++) {
        cout << s[i];
        Sleep(444);
    }
    cout << "\n";
}
HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord;
 
void locate(int x,int y)
{
    coord.X=y;
    coord.Y=x;
    SetConsoleCursorPosition(hout,coord);
};
 
/*** 隐藏光标 ***/
void hide()
{
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(hout, &cursor_info);
}
 
/*** 生成随机数 ***/
double random(double start, double end)
{
    return start+(end-start)*rand()/(RAND_MAX + 1.0);
}
 
/*** 定义地图的长宽,蛇的坐标,长度,方向,食物的位置 ***/
int m,n;
 
struct node
{
    int x,y;
}snake[1000];
 
int snake_length,dir;
node food;
int direct[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
 
/*** 输出墙 ***/
void print_wall()
{
    cout << " ";
    for (int i=1;i<=n;i++)
        cout << "-";
    cout << endl;
    for (int j=0;j<=m-1;j++)
    {
        cout << "|";
        for (int i=1;i<=n;i++) cout << " ";
        cout << "|" << endl;
    }
    cout << " ";
    for (int i=1;i<=n;i++)
        cout << "-";
}
 
/*** 首次输出蛇,其中snake[0]代表头 ***/
void print_snake()
{
    locate(snake[0].x,snake[0].y);
    cout << "@";
    for (int i=1;i<=snake_length-1;i++)
    {
        locate(snake[i].x,snake[i].y);
        cout << "*";
    }
}
 
/*** 判断是否撞墙或者自撞 ***/
bool is_correct()
{
    if (snake[0].x==0 || snake[0].y==0 || snake[0].x==m+1 || snake[0].y==n+1) return false;
    for (int i=1;i<=snake_length-1;i++)
    {
        if (snake[0].x==snake[i].x && snake[0].y==snake[i].y) return false;
    }
    return true;
}
 
/*** 随机生成并输出食物位置 ***/
bool print_food()
{
    srand((unsigned)time(0));
    bool e;
    while (1)
    {
        e=true;
        int i=(int) random(0,m)+1,j=(int) random(0,n)+1;
        food.x=i;food.y=j;
        for (int k=0;k<=snake_length-1;k++)
        {
            if (snake[k].x==food.x && snake[k].y==food.y)
            {
                e=false;break;
            }
        }
        if (e) break;
    }
    locate(food.x,food.y);
    cout << "$";
    return true;
}
 
/*** 蛇的前进 ***/
bool go_ahead()
{
    node temp;
    bool e=false;
    temp=snake[snake_length-1];
    for (int i=snake_length-1;i>=1;i--)
        snake[i]=snake[i-1];
    snake[0].x+=direct[dir][0];
    snake[0].y+=direct[dir][1];
    locate(snake[1].x,snake[1].y);
    cout << "*";
    /*** 吃到了食物 ***/
    if (snake[0].x==food.x && snake[0].y==food.y)
    {
        snake_length++;
        e=true;
        snake[snake_length-1]=temp;
    }
    /*** 输出此时蛇状态 ***/
    if (!e)
    {
        locate(temp.x,temp.y);
        cout << " ";
    }
    else
        print_food();
    locate(snake[0].x,snake[0].y);
    cout << "@";
    /*** 如果自撞 ***/
    if (!is_correct())
    {
        system("cls");
        cout << "You lose!" << endl << "Length: " << snake_length << endl;
        return false;
    }
    return true;
}
int main(){
    SetConsoleOutputCP(65001);
    system("title NBA-OFFICE");
    for(int i=1;;i++){
        cout<<"登录NBA-OFFICE"<<endl;
        cout<<endl;
        cout<<"用户名:";
        cin>>id;
        cout<<"----------"<<endl;
        cout<<"密码:";
        cin>>psw;
        cout<<"加载中......"<<endl;
        cout<<"----------"<<endl;
        if(id==ID&&psw==PSW){
            for(int i=1;;i++){
                system("cls");
                time_t now=time(NULL);
                tm *tm_t=localtime(&now);
                int year=tm_t->tm_year+1900,month=tm_t->tm_mon+1,day=tm_t->tm_mday,hour=tm_t->tm_hour;
                cout<<"欢迎来到NBA-OFFICE龙行天下2024新年版"<<endl<<"你好,罗斯。"<<endl<<"今天是 "<<year<<" 年 "<<month<<" 月 "<<day<<"日"<<endl;
                printf("按“1”:查看今日消耗卡路里总量\n");
                printf("按“2”:查看球队比赛总场次\n");
                printf("按“3”:查看个人信息\n");
                printf("按“4”:玩小游戏“打怪小游戏”\n");
                printf("按“5”猜猜数吧\n");
                printf("按“0”退出NBA-OFFICE");
                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<<"##########################################    ############\n"<<endl;
                cout<<"NBA-OFFICE提醒您:";
                if(hour>=5&&hour<=10){
                    color_print(0,255,255,"早晨起来,拥抱太阳,开启美好的一天。");
                }
                else if(hour>=21&&hour<=23){
                    color_print(255,0,255,"晚安,祝你做个好梦");
                }
                else if(hour==10||hour>=13&&hour<=16){
                    color_print(255,255,0,"加油!努力!");
                }
                else if(hour>=11&&hour<=12){
                    color_print(0,0,255,"先停下来吃点东西吧");
                }
                else if(hour>=17&&hour<=20){
                    color_print(255,0,0,"吃饱了才有力气内卷嘛!");
                }
                else{
                    color_print(255,255,255,"Sleeping………………");
                }
                cout<<"\n\n";
                cout<<"作者:胡睿颢\n特别鸣谢:姜陈沨";
                cout<<endl<<"PS:有彩蛋哦!";
                char n=getch();
                if(n=='1'){
                    system("cls");
                    cout<<"今日消耗卡路里总量:";
                    srand(time(0));
                    int a=rand()%1901+100;
                    cout<<a;
                    cout<<"\n\n\n\n退出请按“1”"<<endl<<"退出网站请按“2”";
                    char x=getch();
                    if(x=='1'){
                        continue;
                    }
                    if(x=='2'){
                        return 0;
                    }
                }
                if(n=='2'){
                    system("cls");
                    cout<<"球队比赛总场次:";
                    srand(time(0));
                    int a=rand()%1501+500;
                    cout<<a;
                    cout<<"\n\n\n\n退出请按“1”"<<endl<<"退出网站请按“2”";
                    char x=getch();
                    if(x=='1'){
                        continue;
                    }
                    if(x=='2'){
                        return 0;
                    }
                }
                if(n=='3'){
                    system("cls");
                    cout<<"个人信息:"<<endl;
                    cout<<"姓名:德里克-罗斯"<<endl;
                    cout<<"年龄:35岁"<<endl;
                    cout<<"身高:188厘米"<<endl;
                    cout<<"体重:90.5千克"<<endl;
                    cout<<"出生地:美利坚合众国,芝加哥"<<endl;
                    cout<<"所在球队:菲尼克斯公牛队"<<endl;
                    cout<<"用户注册时长(天):";
                    srand(time(0));
                    int a=rand()%2651+1000;
                    cout<<a;
                    cout<<"\n\n\n\n退出请按“1”"<<endl<<"退出网站请按“2”";
                    char x=getch();
                    if(x=='1'){
                        continue;
                    }
                    if(x=='2'){
                        return 0;
                    }
                 }
                 if(n=='4'){
                     system("cls");
                    if((hour>=21&&hour<=24)||(hour>=1&&hour<6)){
                         color_print(255,255,0,"现在不是开放时间哦!\n开放时间:6:00 ~ 21:00\n\n\n\n");
                         system("pause");
                    }
                    else{
                        print("打怪小游戏");
                        zhujiemian();
                    }
                }if(n=='0'){
                    printf("再见!");
                    exit(0);
                }if(n=='5'){
                    system("cls");
                    cls();
                ccc("输入范围 输入0关闭");
                int n;
                cin >> n;
                if(n == 0)return 0;
                cls();
                printf("范围为 1 ~ %d\n",n); 
                long long s = power(n);
                long long ans = rand() % n + 1;
                printf("你最少要猜%d次,更少算我输!\n",s);
                ccc("猜吧");
                long long sum = 1;
                while(1) {
                    int x;
                    cin >> x;
                    if(x > ans) {
                        ccc("大了");
                        sum++;
                    }
                    else if(x < ans) {
                        ccc("小了");
                        sum++;
                    }
                    else {
                        cls();
                        c_slow("Yes!");
                        printf("你用了%d次!",sum);
                        break;
                    }
                }
            }
            if(n=='6'){
                system("cls");
                cout<<"恭喜!触发彩蛋!";
                cout<<endl<<"无限制玩“打怪小游戏”哦~~~"<<endl;
                print("打怪小游戏");
                zhujiemian();
                }
            }
        }
        else{
            cout<<"错误:"<<endl;
            if(id!=ID)cout<<"用户名错误!"<<endl;
            if(psw!=PSW)cout<<"密码错误!"<<endl;
            system("pause");
            system("cls");
            }
        if(i==6){
            cout<<"此功能已停用!"<<endl;
            cout<<endl;
            break;
        }
    }
    cout<<"网站来自:NBA-OFFICE";
    return 0;
}

原创:SYe666

特别鸣谢:生姜

#可转

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值