c++不知道哪错了,求检查

问题遇到的现象和发生背景

不知道哪里错了

用代码块功能插入代码,请勿粘贴截图
#include
using namespace std;
int main()
{
    int harmful, beneficial, n = 0;
    cin >> n;
    for (int a = 1;a <= n;a++)
    {

        int i = 0;
        cin >> harmful >> beneficial;
        for (i=0;harmful > 0;i++)
        {
            beneficial = 1.05 * beneficial; harmful = 2 * (harmful - beneficial);
            if (harmful > 1000000)
                harmful = 1000000;
            
        }
        cout << i<return 0;
}

运行结果及报错内容

img

我的解答思路和尝试过的方法

这是题目

img

#include<iostream>
using namespace std;
int main()
{
    int harmful, beneficial, n = 0;
    cin >> n;
    for (int a = 1;a <= n;a++)
    {
 
        int i = 0;
        cin >> harmful >> beneficial;
        for (i=0;harmful > 0;i++)
        {
            harmful = 2 * (harmful - beneficial);beneficial = 1.05 * beneficial; 
            if (harmful > 1000000)
                harmful = 1000000;
            
        }
        cout << i<<endl;
    }
    return 0;
}
 

问题出在是先杀菌再繁殖

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^