• Bio

    image image image image image image image image image **image **我是ENFP哈 image image

    #include <iostream> #include <ctime> using namespace std;

    // 每个月的天数(平年) int daysInMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};

    // 判断是否是闰年 bool isLeap(int year) { return (year%40 && year%100!=0) || (year%4000); }

    // 计算两个日期之间的 岁、月、日 void calcAge(int by, int bm, int bd, int cy, int cm, int cd) { int y, m, d;

    y = cy - by;
    m = cm - bm;
    d = cd - bd;
    
    // 天数不够,向前借一个月
    if (d < 0) {
        m--;
        int lastMonth = cm - 1;
        int lastYear = cy;
        if (lastMonth == 0) {
            lastMonth = 12;
            lastYear--;
        }
        int maxDay = daysInMonth[lastMonth-1];
        if (lastMonth == 2 && isLeap(lastYear)) maxDay = 29;
        d += maxDay;
    }
    
    // 月数不够,向前借一年
    if (m < 0) {
        y--;
        m += 12;
    }
    
    cout << "\n你的精确年龄:" << y << " 岁 " << m << " 个月 " << d << " 天" << endl;
    

    }

    int main() { int by, bm, bd;

    cout << "请输入出生年份:"; cin >> by;
    cout << "请输入出生月份:"; cin >> bm;
    cout << "请输入出生日期:"; cin >> bd;
    
    // 获取当前系统时间
    time_t now = time(0);
    tm ltm = *localtime(&now);
    int cy = 1900 + ltm.tm_year;
    int cm = 1 + ltm.tm_mon;
    int cd = ltm.tm_mday;
    
    // 计算并输出精确年龄
    calcAge(by, bm, bd, cy, cm, cd);
    
    return 0;
    

    }

    #include <windows.h> #include <ctime>

    // 日期计算工具 bool isLeap(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); }

    int getDays(int year, int month) { int dim[] = {31,28,31,30,31,30,31,31,30,31,30,31}; if (month == 2 && isLeap(year)) return 29; return dim[month-1]; }

    void CalcAge(int by,int bm,int bd,int cy,int cm,int cd,int& y,int& m,int& d) { y = cy - by; m = cm - bm; d = cd - bd; if (d < 0) { m--; d += getDays(cy, cm-1>0?cm-1:12); } if (m < 0) { y--; m += 12; } }

    // 窗口控件定义 HWND hY, hM, hD, hBtn, hRes;

    // 按钮点击事件 void OnCalc() { char buf[20]; GetWindowTextA(hY, buf, 20); int by = atoi(buf); GetWindowTextA(hM, buf, 20); int bm = atoi(buf); GetWindowTextA(hD, buf, 20); int bd = atoi(buf);

    time_t t = time(0);
    tm* lt = localtime(&t);
    int cy = 1900 + lt->tm_year;
    int cm = 1 + lt->tm_mon;
    int cd = lt->tm_mday;
    
    int y,m,d;
    CalcAge(by,bm,bd,cy,cm,cd,y,m,d);
    
    char res[100];
    wsprintfA(res, "精确年龄:%d 岁 %d 个月 %d 天", y,m,d);
    SetWindowTextA(hRes, res);
    

    }

    // 窗口过程 LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { switch(msg) { case WM_CREATE: CreateWindowA("STATIC", "出生年份:", WS_VISIBLE|WS_CHILD, 30,40,80,25,hWnd,NULL,0,0); hY = CreateWindowA("EDIT", "", WS_VISIBLE|WS_CHILD|WS_BORDER, 110,40,100,25,hWnd,NULL,0,0); CreateWindowA("STATIC", "出生月份:", WS_VISIBLE|WS_CHILD, 30,80,80,25,hWnd,NULL,0,0); hM = CreateWindowA("EDIT", "", WS_VISIBLE|WS_CHILD|WS_BORDER, 110,80,100,25,hWnd,NULL,0,0); CreateWindowA("STATIC", "出生日期:", WS_VISIBLE|WS_CHILD, 30,120,80,25,hWnd,NULL,0,0); hD = CreateWindowA("EDIT", "", WS_VISIBLE|WS_CHILD|WS_BORDER, 110,120,100,25,hWnd,NULL,0,0); hBtn = CreateWindowA("BUTTON", "计算精确年龄", WS_VISIBLE|WS_CHILD, 50,170,150,35,hWnd,NULL,0,0); hRes = CreateWindowA("STATIC", "", WS_VISIBLE|WS_CHILD, 30,220,300,30,hWnd,NULL,0,0); break; case WM_COMMAND: if ((HWND)lp == hBtn) OnCalc(); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd,msg,wp,lp); } return 0; }

    // 主函数 int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR cmd,int n) { WNDCLASSA wc = {0}; wc.lpfnWndProc = WndProc; wc.lpszClassName = "AgeCalc"; wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); RegisterClassA(&wc);

    HWND hWnd = CreateWindowA("AgeCalc", "精确年龄计算器 - 图形窗口版",
        WS_OVERLAPPED|WS_SYSMENU, 100,100,280,320,0,0,h,0);
    
    ShowWindow(hWnd, n);
    UpdateWindow(hWnd);
    
    MSG msg;
    while(GetMessage(&msg,0,0,0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)msg.wParam;
    

    }

    #include <iostream> #include <string> #include <cctype> using namespace std;

    // 转小写(方便输入不区分大小写) string toLower(string s) { for (int i = 0; i < s.size(); i++) { s[i] = tolower(s[i]); } return s; }

    // 中国国旗 void china() { cout << "==================== 中国国旗 ====================\n"; cout << "★★★★★★★★★★★★★★★★★★★★\n"; cout << "★ ★\n"; cout << "★ ★★★ ★\n"; cout << "★ ★★★★★ ★\n"; cout << "★ ★★★ ★\n"; cout << "★ ★\n"; cout << "★ ★\n"; cout << "★ ★\n"; cout << "★★★★★★★★★★★★★★★★★★★★\n"; }

    // 美国国旗 void usa() { cout << "==================== 美国国旗 ====================\n"; cout << "★★★★★★★★★★ |██████████████████|\n"; cout << "★★★★★★★★★★ |██████████████████|\n"; cout << "★★★★★★★★★★ |██████████████████|\n"; cout << "★★★★★★★★★★ |██████████████████|\n"; cout << "--------------------------------------------\n"; cout << "████████████████████████████████████████████\n"; cout << "--------------------------------------------\n"; cout << "████████████████████████████████████████████\n"; cout << "--------------------------------------------\n"; }

    // 日本国旗 void japan() { cout << "==================== 日本国旗 ====================\n"; cout << " ██████ \n"; cout << " ██████████ \n"; cout << " ██████████████ \n"; cout << " ██████████████ \n"; cout << " ██████████ \n"; cout << " ██████ \n"; }

    // 法国国旗 void france() { cout << "==================== 法国国旗 ====================\n"; cout << "██████ ██████████ ██████\n"; cout << "██████ ██████████ ██████\n"; cout << "██████ ██████████ ██████\n"; cout << "██████ ██████████ ██████\n"; cout << "██████ ██████████ ██████\n"; }

    // 德国国旗 void germany() { cout << "==================== 德国国旗 ====================\n"; cout << "██████████████████████████████\n"; cout << "██████████████████████████████\n"; cout << "██████████████████████████████\n"; cout << "██████████████████████████████\n"; cout << "██████████████████████████████\n"; }

    // 英国国旗 void uk() { cout << "==================== 英国国旗 ====================\n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; cout << " ★★★★★★★★★ \n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; cout << " ★ ★ \n"; }

    // 韩国国旗 void korea() { cout << "==================== 韩国国旗 ====================\n"; cout << " ○○○○○ \n"; cout << " ○○○○○○○ \n"; cout << " ○○○○○○○○○ \n"; cout << " ○○○○○○○○○ \n"; cout << " ○○○○○○○ \n"; cout << " ○○○○○ \n"; }

    int main() { string country;

    cout << "===== 国家国旗生成器 =====" << endl;
    cout << "支持:中国、美国、日本、法国、德国、英国、韩国" << endl;
    cout << "请输入国家名:";
    cin >> country;
    
    country = toLower(country);
    
    if (country == "中国" || country == "china") {
        china();
    } else if (country == "美国" || country == "usa") {
        usa();
    } else if (country == "日本" || country == "japan") {
        japan();
    } else if (country == "法国" || country == "france") {
        france();
    } else if (country == "德国" || country == "germany") {
        germany();
    } else if (country == "英国" || country == "uk") {
        uk();
    } else if (country == "韩国" || country == "korea") {
        korea();
    } else {
        cout << "暂不支持该国家!" << endl;
    }
    
    return 0;
    

    }

    #include <iostream> #include <windows.h> #include <iomanip> #include <string> #include <cstdlib> #include <ctime>

    using namespace std;

    void delay(int ms) { Sleep(ms); }

    void loading(string text) { cout << "[*] " << text << " "; for (int i = 0; i < 30; i++) { cout << "■"; delay(30); } cout << " 完成\n"; }

    void progress(int p) { cout << "\r扫描进度:["; int full = p / 2; for (int i = 0; i < 50; i++) { if (i < full) cout << "█"; else cout << " "; } cout << "] " << setw(3) << p << "%"; cout.flush(); }

    void logo() { system("title 高级系统安全防护工具 · 病毒清除中心"); system("color 0A"); cout << "\n"; cout << " ==============================================\n"; cout << " 高级病毒查杀引擎 v3.8\n"; cout << " 系统安全 · 深度防护 · 强力清除\n"; cout << " ==============================================\n\n"; }

    void menu() { cout << " ===================== 功能菜单 =====================\n"; cout << " 1. 快速查杀(推荐)\n"; cout << " 2. 全盘深度扫描\n"; cout << " 3. 系统修复\n"; cout << " 4. 查看日志\n"; cout << " 5. 退出程序\n"; cout << " ====================================================\n"; cout << " 请输入选择:"; }

    void quick_scan() { cout << "\n[+] 启动快速查杀...\n\n"; loading("加载病毒库"); loading("初始化内存扫描"); cout << "\n";

    string files[] = {
        "C:\\Windows\\System32\\kernel32.dll",
        "C:\\Users\\Admin\\AppData\\Temp\\cache.tmp",
        "C:\\Program Files\\Common Files\\system.dll",
        "C:\\bootmgr.exe",
        "C:\\Windows\\explorer.exe"
    };
    
    int virus = 0;
    for (int i = 0; i <= 100; i++) {
        progress(i);
        if (i % 20 == 0) {
            int idx = i / 20;
            if (idx < 5) {
                cout << "\n    扫描:" << files[idx];
                if (rand() % 2 == 0) {
                    cout << "  —— 发现病毒:Trojan/Win32.Agent";
                    virus++;
                }
            }
        }
        delay(60);
    }
    cout << "\n\n[√] 快速查杀完成!发现威胁:" << virus << " 个\n";
    

    }

    void full_scan() { cout << "\n[+] 启动全盘深度扫描...\n\n"; loading("加载云查杀引擎"); loading("扫描引导区"); loading("扫描注册表"); loading("扫描系统驱动"); loading("扫描启动项"); cout << "\n";

    int virus = 0;
    for (int i = 0; i <= 100; i++) {
        progress(i);
        if (i % 10 == 0) {
            cout << "\n    深度扫描:分区 " << (i / 10 + 1);
            if (rand() % 3 == 0) {
                cout << "  —— 发现恶意程序";
                virus++;
            }
        }
        delay(45);
    }
    cout << "\n\n[√] 全盘扫描完成!发现威胁:" << virus + 2 << " 个\n";
    

    }

    void remove_virus() { cout << "\n[!] 开始清除病毒...\n\n"; string vlist[] = { "Trojan.Win32.Generic", "Backdoor.Win32.RAT", "Adware.Win32.Popup", "Rootkit.Win32.Hidden" }; for (int i = 0; i < 4; i++) { cout << " 清除:" << vlist[i] << " —— 已清除\n"; delay(400); } cout << "\n[√] 所有病毒已彻底清除!\n"; }

    void repair() { cout << "\n[*] 开始系统修复...\n\n"; loading("修复注册表"); loading("修复系统文件"); loading("恢复服务配置"); loading("清理启动项病毒"); loading("重建安全策略"); cout << "\n[√] 系统已完全修复!\n"; }

    void log() { cout << "\n==================== 安全日志 \n"; cout << "扫描时间:" << TIME << "\n"; cout << "病毒库版本:2025-V8\n"; cout << "发现威胁:3 个\n"; cout << "已清除:3 个\n"; cout << "系统状态:安全\n"; cout << "===============================\n"; }

    void success() { system("color 2F"); cout << "\n\n"; cout << " ==============================================\n"; cout << " 病毒已完全解除!\n"; cout << " 您的电脑已恢复至安全状态\n"; cout << " ==============================================\n\n"; }

    int main() { srand(time(0)); logo();

    string pwd;
    cout << "  请输入管理员密码以继续:";
    cin >> pwd;
    if (pwd != "123456") {
        cout << "\n[-] 密码错误!程序退出。\n";
        system("pause");
        return 0;
    }
    cout << "\n[√] 密码正确,欢迎使用高级杀毒工具!\n\n";
    system("pause");
    
    while (true) {
        system("cls");
        logo();
        menu();
    
        int ch;
        cin >> ch;
        if (ch == 1) quick_scan();
        else if (ch == 2) full_scan();
        else if (ch == 3) repair();
        else if (ch == 4) log();
        else if (ch == 5) {
            cout << "\n[*] 感谢使用,再见!\n";
            break;
        } else {
            cout << "\n[-] 输入错误!\n";
        }
    
        if (ch == 1 || ch == 2) {
            remove_virus();
            success();
        }
    
        cout << "\n";
        system("pause");
    }
    
    return 0;
    

    }

  • Accepted Problems

  • Recent Activities

  • Recent Solutions

    This person is lazy and didn't wrote any solution

Problem Tags

2016
1
NOIP 提高组
1