制作一个简单的操作系统

二话不说,先上代码!

#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void A_hongshuye()
{
    char a,b[10240];
    cout<<"0=black, 1=blue, 2=green, 3=lake blue, 4=red, 5=purple, 6=yellow, 7=white, 8=grey, 9=light blue"<<endl<<"A=light green, B=light green, C=light red, D=light purple, E=light yellow, F=bright white"<<endl<<endl<<endl;
    cout<<"Please select a background code:";
    cin>>a;
    if(a=='0'){system("color 07");}
    if(a=='1'){system("color 17");}
    if(a=='2'){system("color 27");}
    if(a=='3'){system("color 37");}
    if(a=='4'){system("color 47");}
    if(a=='5'){system("color 57");}
    if(a=='6'){system("color 67");}
    if(a=='7'){system("color 77");}
    if(a=='8'){system("color 87");}
    if(a=='9'){system("color 97");}
    if(a=='A'){system("color A7");}
    if(a=='B'){system("color B7");}
    if(a=='C'){system("color C7");}
    if(a=='D'){system("color D7");}
    if(a=='E'){system("color E7");}
    if(a=='F'){system("color F7");}
    system("cls");
    for(int i=0;i<=1023;i++){
        cin>>b[i];
    }
}
void A_num(){
    double num1,num2;
    char f;
    cin>>num1>>f>>num2;
    if(f=='+'){cout<<num1+num2;}
    if(f=='-'){cout<<num1-num2;}
    if(f=='*'){cout<<num1*num2;}
    if(f=='/'){cout<<num1/num2;}
    Sleep(5000);
    }
void A_time(){
    int y;
    cout<<"Counting seconds>>";
    cin>>y;
    Sleep(y*1000);
    system("cls");
    cout<<"Time is up.";
    system("color C7");
    Sleep(3000);
    }
void A_pic(){
    system("cls");
    int a,b;
    char c;
    cout<<"Data>>";
    cin>>a>>b>>c;
        for(int i=0;i<a;i++)
        {
            for(int j=0;j<b;j++)
            {
                if(i==0||i==a-1||j==0||j==b-1)
                    cout<<c;
                else
                    cout<<" ";
            }
        cout<<endl;
        }
    Sleep(10000);
}
void B_coll(){
    system("cls");
    system("color 47");
    cout<<"[invalid]";
    Sleep(3500);
    }
int main()
{
    system("title Quild XT3S");
    int s;
    int u;
    cout<<"UHD>>";
    cin>>u;
    if(!u){
        return 0;
    }
    system("cls");
    Sleep(1000);
    cout<<"Welcome to Quild system."<<endl<<endl<<endl;
    for(int i=1;i<=20;i++){
                cout<<"|";
                Sleep(250);
            }
    Sleep(2500);
    while(true){
        system("cls");
        system("color 07");
        int x;
        time_t nowtime;
            struct tm* p;;
            time(&nowtime);
            p = localtime(&nowtime);
            printf("%02d:%02d\n\n",p->tm_hour,p->tm_min);
        cout<<"A Hard Disk"<<endl<<endl;
        cout<<"1. Drawing"<<endl<<"2. redleevbook"<<endl<<"3. numbers"<<endl<<"4. timer"<<endl<<"5. administrators"<<endl<<endl;
        cout<<"AHD>>";
        cin>>x;
        if(x==1){
            A_pic();
        }
        else if(x==2){
            system("cls");
            A_hongshuye();
        }
        else if(x==3){
            system("cls");
            A_num();}
        else if(x==5){
            system("cls");
            int c;
            cout<<"B Hard Disk"<<endl<<endl;
            cout<<"1. shutdown"<<endl;
            cout<<"2. version"<<endl;
            cout<<"3. repair"<<endl<<endl;
            cout<<"BHD>>";
            cin>>c;
            if(c==1){system("cls");Sleep(1000);
                return 0;}
            else if(c==2){system("cls");
                cout<<"Quild XT3S @SKM-A";
                Sleep(5000);}
            else if(c==3){system("cls");
                for(int i=1;i<=20;i++){
                    cout<<"|";
                    Sleep(250);
            }}
            else{
                B_coll();
            }
            }
        else if(x==4){system("cls");
            A_time();
            }
        else{
            B_coll();
        }
    }
    return 0;
}

系统名称:Quild XT3S

编写语言:C++

发布时间:2023/01/13 22:27 (北京时间)

下载链接:https://files.catbox.moe/gpxuvt.zip

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在C语言中,我们可以使用图形库来创建简单的界面。其中,常用的图形库有: 1. GTK+: 一个跨平台的图形用户界面工具包,可以在多个操作系统上使用。 2. Qt: 一个跨平台的C++ GUI应用程序开发框架,也可以在多个操作系统上使用。 3. WinAPI: 一套可在Microsoft Windows操作系统上使用的应用程序编程接口。 假设你使用的是Windows操作系统,下面是一个简单的例子: ```c #include <windows.h> LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // 创建窗口类 WNDCLASS wc = {0}; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = "MyWindowClass"; RegisterClass(&wc); // 创建窗口 HWND hwnd = CreateWindow("MyWindowClass", "My Window", WS_OVERLAPPEDWINDOW, 100, 100, 500, 500, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, nCmdShow); // 消息循环 MSG msg = {0}; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; } ``` 这个程序创建了一个简单的窗口,并在窗口关闭时退出。如果你想要添加更多的控件,比如按钮、文本框等,你可以使用Windows API提供的API来绘制它们。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值