猫史档案馆


朱珅宇

朱珅宇

Lv.1

获赞:17收藏:0浏览:122作品收藏:1
回复帖子评论
上一页1 页 / 共 1下一页

有谁会DEV-C++吗 中回复

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

int main()
{
long long num;
cout << "请输入起始数字:";
cin >> num;

while(true)
{
cout << "当前数值:" << num << endl;
if(num % 2 == 1)
{
// 单数 乘以2
num = num * 2;
cout << "判定单数,执行 ×2\n";
}
else
{
// 双数 除以2再加1
num = num / 2 + 1;
cout << "判定双数,执行 ÷2 +1\n";
}
cout << "-----------------\n";
Sleep(1000); // 间隔1秒运算
}
return 0;
}

2026-05-23T22:03:36 点赞:0