下载Ollama网址:irm https://ollama.com/install.ps1 | iex(把这个粘贴到PowerShell里)

下载Ollama

(作者留言:如果不下载Ollama   c++程序直接罢工)

C++代码

#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;

int a;
int use_time = 0;
int money = 1000000;  // 初始余额

int main() {
    cout << "welcome to AI windows ." << endl;
    cout << "this have 5 model" << endl;
    cout << "model:" << endl;
    cout << "1:qwen2.5(免费)" << endl;
    cout << "2:4090x8 qwen2.5" << endl;
    cout << "3:5090FEx8 qwen2.5:1.8b 10Doller" << endl;
    cout << "4:4070Dx10 qwen2.5:7b 50Doller" << endl;
    cout << "5:5090Dx10 qwen2.5:14b 100Doller" << endl;
    cin >> a;

    switch (a) {
    case 1: {
        cout << "正在加载AI..." << endl;
        Sleep(1000);
        system("cls");
        system("start powershell -NoExit -Command \"ollama run qwen2.5\"");
        system("cls");
        cout << "X云;计费中(免费模式)" << endl;
        cout << "============================" << endl;

        while (true) {
            use_time++;
            cout << "余额:" << money << "  时长:" << use_time << "秒" << endl;
            Sleep(1);
        }
        break;
    }

    case 2: {
        cout << "正在加载显卡!" << endl;
        Sleep(1000);
        system("cls");
        system("start powershell -NoExit -Command \"ollama run qwen2.5\"");
        cout << "X云;计费中..." << endl;
        cout << "============================" << endl;
        cout << "【按 R 键充值】" << endl;

        while (true) {
            use_time++;

            if (use_time % 60 == 0) {
                money -= 1;
            }

            cout << "余额:" << money << "  时长:" << use_time << "秒" << endl;

            // ========= 修复:1ms 循环下可用的充值 =========
            static bool key_down = false;
            if (_kbhit()) {
                char key = _getch();
                if ((key == 'r' || key == 'R') && !key_down) {
                    key_down = true;
                    int add_money;
                    cout << "\n===== 充值系统 =====" << endl;
                    cout << "请输入充值金额:";
                    cin >> add_money;
                    if (add_money > 0) {
                        money += add_money;
                        cout << "充值成功!当前余额:" << money << endl;
                    }
                    else {
                        cout << "输入无效!" << endl;
                    }
                    cout << "====================" << endl;
                }
            }
            else {
                key_down = false;
            }
            // ==============================================

            Sleep(1);

            if (money <= 0) {
                cout << "余额不足,已停止服务!" << endl;
                break;
            }
        }
        break;
    }

    case 3: {
        cout << "正在加载显卡!" << endl;
        Sleep(1000);
        system("cls");
        system("start powershell -NoExit -Command \"ollama run qwen2.5\"");
        cout << "X云;计费中..." << endl;
        cout << "============================" << endl;
        cout << "【按 R 键充值】" << endl;

        while (true) {
            use_time++;
            if (use_time % 50 == 0) {
                money -= 1;
            }

            cout << "余额:" << money << "  时长:" << use_time << "秒" << endl;

            static bool key_down = false;
            if (_kbhit()) {
                char key = _getch();
                if ((key == 'r' || key == 'R') && !key_down) {
                    key_down = true;
                    int add_money;
                    cout << "\n===== 充值系统 =====" << endl;
                    cout << "请输入充值金额:";
                    cin >> add_money;
                    if (add_money > 0) {
                        money += add_money;
                        cout << "充值成功!当前余额:" << money << endl;
                    }
                    else {
                        cout << "输入无效!" << endl;
                    }
                }
            }
            else {
                key_down = false;
            }

            Sleep(1);
            if (money <= 0) {
                cout << "余额不足,已停止服务!" << endl;
                break;
            }
        }
        break;
    }

    case 4: {
        cout << "正在加载显卡!" << endl;
        Sleep(1000);
        system("cls");
        system("start powershell -NoExit -Command \"ollama run qwen2.5\"");
        cout << "X云;计费中..." << endl;
        cout << "============================" << endl;
        cout << "【按 R 键充值】" << endl;

        while (true) {
            use_time++;
            if (use_time % 10 == 0) {
                money -= 1;
            }

            cout << "余额:" << money << "  时长:" << use_time << "秒" << endl;

            static bool key_down = false;
            if (_kbhit()) {
                char key = _getch();
                if ((key == 'r' || key == 'R') && !key_down) {
                    key_down = true;
                    int add_money;
                    cout << "\n===== 充值系统 =====" << endl;
                    cout << "请输入充值金额:";
                    cin >> add_money;
                    money += add_money;
                    cout << "充值成功!当前余额:" << money << endl;
                }
            }
            else {
                key_down = false;
            }

            Sleep(1);
            if (money <= 0) {
                cout << "余额不足,已停止服务!" << endl;
                break;
            }
        }
        break;
    }

    case 5: {
        cout << "正在加载显卡!" << endl;
        Sleep(1000);
        system("cls");
        system("start powershell -NoExit -Command \"ollama run qwen2.5\"");
        cout << "X云;计费中..." << endl;
        cout << "============================" << endl;
        cout << "【按 R 键充值】" << endl;

        while (true) {
            use_time++;
            if (use_time % 5 == 0) {
                money -= 1;
            }

            cout << "余额:" << money << "  时长:" << use_time << "秒" << endl;

            static bool key_down = false;
            if (_kbhit()) {
                char key = _getch();
                if ((key == 'r' || key == 'R') && !key_down) {
                    key_down = true;
                    int add_money;
                    cout << "\n===== 充值系统 =====" << endl;
                    cout << "请输入充值金额:";
                    cin >> add_money;
                    money += add_money;
                    cout << "充值成功!当前余额:" << money << endl;
                }
            }
            else {
                key_down = false;
            }

            Sleep(1);
            if (money <= 0) {
                cout << "余额不足,已停止服务!" << endl;
                break;
            }
        }
        break;
    }
    }

    cout << "已启动 PowerShell 并运行 AI 模型 qwen2.5\n";
    _getch();
    return 0;
}

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐