问题标题: OXos

0
1
袁刘新楷
袁刘新楷
新手守护
新手守护
//此为 beta 版,仅供测试使用 
/*编辑日志 
2021.01.22 编好开头 版本[0.00] 
2021.01.23 将输出全部变为停顿输出 添加界面,添加应用,添加快速开始(beta) 版本[0.01] 
2021.01.24 添加设置 发现计算器问题 (0X0.02) 版本[0.02] 
2020.01.27 添加本机名称 (Deep Thought)  版本[0.03]  
2021.01.28 修正错误(administrator 拼写错误) (0x0.04r) 修正计算器问题 (0x0.02r) 版本[0.04]  
2021.03.20 添加游戏 [beta0.05] 
*/
#include<bits/stdc++.h>
#include<windows.h>
#include "windows.h"
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
void gotoxy(int x,int y){ //时钟函数 
    COORD pos={x,y};
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut,pos);
}
int js(char s,int a,int b){ //计算器函数 
    if(s=='+') return a+b;
    if(s=='-') return a-b;
    if(s=='*') return a*b;
    if(s=='/') return a/b;
}
/*
0=黑色,1=蓝色,2=绿色,3=湖蓝色,4=红色,5=紫色;

6=黄色,7=白色,8=灰色,9=淡蓝色,A=淡绿色,B=浅绿色;

C=淡红色,D=淡紫色,E=淡黄色,F=亮白色。
*/
HWND hwnd=GetForegroundWindow();//使hwnd代表最前端的窗口
//1----围墙 2----自己 3----终点 0----空地 4----箱子 
int map1[21][21]={
{1,1,1,1,1,1,1,1,1,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,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1},
{1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
};
void cls(){    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 };    // home for the cursor
    SetConsoleCursorPosition( hConsole, coordScreen );
}
bool flag;
string name;
int main(){
    system("color 70");
    Sleep(500);
    cout<<"H";
    Sleep(100);
    cout<<"e";
    Sleep(100);
    cout<<"l";
    Sleep(100);
    cout<<"l";
    Sleep(100);
    cout<<"o";
    Sleep(100);
    cout<<"!"<<endl;
    Sleep(1000);
    cout<<"欢";
    Sleep(100);
    cout<<"迎";
    Sleep(100);
    cout<<"进";
    Sleep(100);
    cout<<"入";
    Sleep(100);
    cout<<" ";
    Sleep(100);
    cout<<"O";
    Sleep(100);
    cout<<"X";
    Sleep(100);
    cout<<"o";
    Sleep(100);
    cout<<"s";
    Sleep(100);
    cout<<" ";
    Sleep(100);
    cout<<"[";
    Sleep(100);
    cout<<"b";
    Sleep(100);
    cout<<"e";
    Sleep(100);
    cout<<"t";
    Sleep(100);
    cout<<"a";
    Sleep(100);
    cout<<"]";
    Sleep(100);
    cout<<" ";
    Sleep(100);
    cout<<"版";
    Sleep(100);
    cout<<"本";
    Sleep(100);
    cout<<"!";
    Sleep(2000);
    system("cls");
    cout<<"请";
    Sleep(100);
    cout<<"稍";
    Sleep(100);
    cout<<"后";
    system("cls");
    for(int i=1;i<=2;i++){
            cout<<"请稍后";
            Sleep(1000);
            for(int j=1;j<=3;j++){
                cout<<'.';
                Sleep(1000);
            }
            system("cls");
        }
    cout<<"请";
    Sleep(100);
    cout<<"登";
    Sleep(100);
    cout<<"录";
    Sleep(100);
    cout<<"账";
    Sleep(100);
    cout<<"号";
    Sleep(100);
    cout<<"!"<<endl;
    Sleep(1000);
    cout<<"键";
    Sleep(100);
    cout<<"入";
    Sleep(100);
    cout<<"1";
    Sleep(100);
    cout<<",";
    Sleep(100);
    cout<<"使";
    Sleep(100);
    cout<<"账";
    Sleep(100);
    cout<<"户";
    Sleep(100);
    cout<<"登";
    Sleep(100);
    cout<<"录";
    Sleep(100);
    cout<<";";
    Sleep(100);
    cout<<"键";
    Sleep(100);
    cout<<"入";
    Sleep(100);
    cout<<"2";
    Sleep(100);
    cout<<",";
    Sleep(100);
    cout<<"使";
    Sleep(100);
    cout<<"用";
    Sleep(100);
    cout<<"“";
    Sleep(100);
    cout<<"A";
    Sleep(100);
    cout<<"d";
    Sleep(100);
    cout<<"m";
    Sleep(100);
    cout<<"i";
    Sleep(100);
    cout<<"n";
    Sleep(100);
    cout<<"i";
    Sleep(100);
    cout<<"s";
    Sleep(100);
    cout<<"t";
    Sleep(100);
    cout<<"r";
    Sleep(100);
    cout<<"a";
    Sleep(100);
    cout<<"t";
    Sleep(100);
    cout<<"o";
    Sleep(100);
    cout<<"r";
    Sleep(100);
    cout<<"”";
    Sleep(100);
    cout<<"登";
    Sleep(100);
    cout<<"录"<<endl;
    string a;
    getline(cin,a);
    system("cls");
    if(a!="beta"){
        if(a=="1"){
            cout<<"您";
            Sleep(100);
            cout<<"已";
            Sleep(100);
            cout<<"使";
            Sleep(100);
            cout<<"用";
            Sleep(100);
            cout<<"账";
            Sleep(100);
            cout<<"户";
            Sleep(100);
            cout<<"登";
            Sleep(100);
            cout<<"录"<<endl;
            Sleep(1000);
            cout<<"请";
            Sleep(100);
            cout<<"输";
            Sleep(100);
            cout<<"入";
            Sleep(100);
            cout<<"用";
            Sleep(100);
            cout<<"户";
            Sleep(100);
            cout<<"名"<<endl;
            getline(cin,name);
            cout<<"成";
            Sleep(200);
            cout<<"功";
            Sleep(200);
            cout<<"!";
            Sleep(2000);
        } 
        else if(a=="2"){
            cout<<"您";
            Sleep(100);
            cout<<"已";
            Sleep(100);
            cout<<"使";
            Sleep(100);
            cout<<"用";
            Sleep(100);
            cout<<"“";
            Sleep(100);
            cout<<"A";
            Sleep(100);
            cout<<"d";
            Sleep(100);
            cout<<"m";
            Sleep(100);
            cout<<"i";
            Sleep(100);
            cout<<"n";
            Sleep(100);
            cout<<"a";
            Sleep(100);
            cout<<"t";
            Sleep(100);
            cout<<"o";
            Sleep(100);
            cout<<"r";
            Sleep(100);
            cout<<"”";
            Sleep(100);
            cout<<"登";
            Sleep(100);
            cout<<"录"<<endl;
            Sleep(1000); 
            cout<<"成";
            Sleep(200);
            cout<<"功";
            Sleep(200);
            cout<<"!";
            Sleep(2000);
        }
        system("cls");
        cout<<"可";
        Sleep(100);
        cout<<"能";
        Sleep(100);
        cout<<"需";
        Sleep(100);
        cout<<"要";
        Sleep(100);
        cout<<"几";
        Sleep(100);
        cout<<"分";
        Sleep(100);
        cout<<"钟";
        Sleep(100);
        cout<<"来";
        Sleep(100);
        cout<<"激";
        Sleep(100);
        cout<<"活";
        Sleep(100);
        cout<<"O";
        Sleep(100);
        cout<<"X";
        Sleep(100);
        cout<<"o";
        Sleep(100);
        cout<<"s";
        Sleep(100);
        system("cls");
        for(int i=1;i<=3;i++){
            cout<<"可能需要几分钟来激活OXos";
            Sleep(1000);
            for(int j=1;j<=3;j++){
                cout<<'.';
                Sleep(1000);
            }
            system("cls");
        }
        cout<<"激";
        Sleep(100);
        cout<<"活";
        Sleep(100);
        cout<<"成";
        Sleep(100);
        cout<<"功";
        Sleep(100);
        cout<<"!";
        Sleep(100);
        cout<<endl; 
        cout<<"您";
        Sleep(100);
        cout<<"已";
        Sleep(100);
        cout<<"成";
        Sleep(100);
        cout<<"功";
        Sleep(100);
        cout<<"进";
        Sleep(100);
        cout<<"入";
        Sleep(100);
        cout<<"系";
        Sleep(100);
        cout<<"统";
        Sleep(100);
        cout<<"!";
        Sleep(3000);
        system("cls");
        cout<<"正";
        Sleep(100);
        cout<<"在";
        Sleep(100);
        cout<<"加";
        Sleep(100);
        cout<<"载";
        Sleep(100);
        cout<<"桌";
        Sleep(100);
        cout<<"面";
        Sleep(100);
        system("cls");
        for(int i=1;i<=100;i++){
            cout<<"正在加载桌面 %";
            cout<<i;
            Sleep(20);
            if(i==39) Sleep(1000);
            if(i==56) Sleep(500);
            if(i==87) Sleep(800);
            if(i==100) Sleep(500);
            system("cls");
        }
        Sleep(1000);
        cout<<"成";
        Sleep(200);
        cout<<"功";
        Sleep(200);
        cout<<"!";
        Sleep(2000);
        system("cls");
    }
    if(a=="beta") name="beta";
    // 以下是系统功能部分
    ShowWindow(hwnd,SW_MAXIMIZE);
    cout<<"键入?以显示帮助..."<<endl;
    char s;
    cin>>s;
    getchar();
    system("cls");
    while(1){
        if(s=='?'){
            cout<<"1";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"时";
            Sleep(100);
            cout<<"钟"<<endl;
            Sleep(100);
            cout<<"2";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"计";
            Sleep(100);
            cout<<"算";
            Sleep(100);
            cout<<"器"<<endl;
            Sleep(100);
            cout<<"3";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"设";
            Sleep(100);
            cout<<"置"<<endl;
            Sleep(100);
            cout<<"4";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"关";
            Sleep(100);
            cout<<"于"<<endl;
            Sleep(100);
            cout<<"5";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"游";
            Sleep(100);
            cout<<"戏"<<endl;
            Sleep(100);
            cout<<"0";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"-";
            Sleep(100);
            cout<<"关";
            Sleep(100);
            cout<<"机"<<endl;
            Sleep(100);
        }
        int check;
        cin>>check;
        getchar();
        system("cls");
        if(check==1){
            int n=0;
            time_t t;
            struct tm *data_time;
            cout<<"时钟 :";
            cout << "当前时间: " << endl; 
            while(1){
                gotoxy(10,0);
                time(&t);
                data_time = localtime(&t);
                cout << data_time->tm_hour << ":" << data_time->tm_min << ":" << data_time->tm_sec ;
                Sleep(1000);
                n++;
                if(n==10) break;
            }
            system("cls");
        }
        else if(check==2){
            cout<<"计算器"<<endl;
            cout<<"请输入一个运算符,两个数字(如 '+ 1 2')"<<endl; //乘除无法使用 [0x0.02] 2020.01.28 [0x0.02r]
            char s;
            int a,b;
            cin>>s>>a>>b;
            getchar();
            cout<<js(s,a,b);
            Sleep(3000);
            system("cls");
        }
        else if(check==3){
            cout<<"设置"<<endl;
            cout<<"当前用户为 "<<name<<" "<<endl;
            cout<<"1 --- 个性化"<<endl;
            cout<<"2 --- 密码"<<endl;
            cout<<"3 --- 更改用户名"<<endl;
            int xx;
            cin>>xx;
            getchar();
            system("cls");
            if(xx==1){
                cout<<"个性化"<<endl;
                int ax;
                system("cls");
                cout<<"1 --- 白蓝"<<endl;
                cout<<"2 --- 黑红"<<endl;
                cout<<"3 --- 灰红"<<endl;
                cout<<"4 --- 白灰"<<endl;
                cout<<"5 --- 默认"<<endl;
                cin>>ax;
                getchar();
                if(ax==1) system("color 73");
                if(ax==2) system("color 04");
                if(ax==3) system("color 74");
                if(ax==4) system("color 78");
                if(ax==5) system("color 70"); 
            } 
            else if(xx==2){
                cout<<"密码"<<endl;
                cout<<"请升级至 OXos 最新版本!";
                Sleep(3000);
            }
            else if(xx==3){
                cout<<"更改用户名"<<endl; 
                cout<<"当前用户为:"<<name<<endl;
                cout<<"请输入用户名"<<endl;
                string as;
                getline(cin,as);
                name=as;
                cout<<"当前用户名已更改为:"<<name;
                Sleep(3000);
            }
            system("cls");
        }
        else if(check==4){
            cout<<"关于"<<endl;
            Sleep(1000);
            cout<<"系统版本 :OXos [beta0.05] 版"<<endl; 
            Sleep(1000);
            cout<<"本机名称:beta"<<endl; 
            Sleep(1000);
            cout<<"本机序列号:yxlOxXko2s0.04beta"<<endl;
            Sleep(1000);
            cout<<"系统创作者 by 舍予"<<endl;
            Sleep(1000);
            cout<<"QQ : 3607221625"<<endl;
            Sleep(5000);
        }
        else if(check==5){
            cout<<"教";
            Sleep(100);
            cout<<"程";
            Sleep(100);
            cout<<":";
            Sleep(100);
            cout<<"w";
            Sleep(100);
            cout<<"跳";
            Sleep(100);
            cout<<"跃";
            Sleep(100);
            cout<<",";
            Sleep(100);
            cout<<"d";
            Sleep(100);
            cout<<"向";
            Sleep(100);
            cout<<"前";
            Sleep(100);
            cout<<",";
            Sleep(100);
            cout<<"a";
            Sleep(100);
            cout<<"向";
            Sleep(100);
            cout<<"后";
            Sleep(100);
            cout<<",";
            Sleep(100);
            cout<<"x";
            Sleep(100);
            cout<<"放";
            Sleep(100);
            cout<<"箱";
            Sleep(100);
            cout<<"子";
            Sleep(4000);
            system("cls");
            ShowWindow(hwnd,SW_MAXIMIZE);
            int x,y;
            int i=0;
            while(map1[x][y]!=3){
                flag=true;
                i++;
                cout<<i<<endl;
                for(int i=0;i<20;i++){
                    for(int j=0;j<20;j++){
                        if(map1[i][j]==1){
                            cout<<"■";
                        } else if(map1[i][j]==0){
                            cout<<"□";
                        } else if(map1[i][j]==2){
                            cout<<"你";
                            x=i,y=j;
                        } else if(map1[i][j]==4){
                            cout<<"▓";
                        }
                        else{
                            cout<<"旗";
                            flag=false;
                        }
                    }
                    cout<<endl;
                }
                if(flag){
                    cout<<"恭喜过关!";
                    break;
                }
                if(map1[x+1][y]!=1&&map1[x+1][y]!=4){
                    map1[x][y]=0; 
                    x++;
                    map1[x][y]=2;
                }
                cls();
                if(GetAsyncKeyState('D')&&y<20&&map1[x][y+1]!=1){
                    map1[x][y]=0;
                    y++;
                    map1[x][y]=2;
                    Sleep(100);
                }
                if(GetAsyncKeyState('A')&&y>=0&&map1[x][y-1]!=1){
                    map1[x][y]=0;
                    y--;
                    map1[x][y]=2;
                    Sleep(100);
        }
        if(GetAsyncKeyState('X')&&x>=0&&map1[x-1][y]!=1){
            map1[x][y]=4;
            x--;
            map1[x][y]=2;
            Sleep(100);
        }
        if(GetAsyncKeyState('W')&&(map1[x+1][y]==1||map1[x+1][y]==4)&&x>=0&&map1[x-3][y]!=1){
            map1[x][y]=0;
            x-=3;
            map1[x][y]=2;
            Sleep(2000);
        }
    }
    Sleep(100);
        } 
        else if(check==0){
            for(int i=1;i<=2;i++){
                cout<<"正在关机";
                Sleep(1000);
                for(int j=1;j<=3;j++){
                    cout<<'.';
                    Sleep(1000);
                }
                system("cls");
            }
            break; 
        }
        system("cls");
    }
    return 0;
}

 


0
0
0
0
袁刘新楷
袁刘新楷
新手守护
新手守护

袁刘新楷在2021-05-15 19:47:56追加了内容

大佬们能帮我看看吗?

本人第一次写系统,欢迎指教!!!

不会结贴,不断更新(现在是beta0.05)!!!

0
0
吴庞茂旭
吴庞茂旭
资深光能
资深光能

哈哈,居然有偶的代码!

最近BW要更新了,我授权你使用我的代码!

0
0
0
0
我要回答