本文介绍了如何让我的程序在计算过程中不冻结?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我重复这段代码10次。
如何让我的程序不冻结,而是开始漂亮的进度条。
不知道我是否明确表示抱歉:)
我尝试过:
Hi,
So I repeat this code 10 times.
How can I make my program not freeze but instead a pretty progressbar starts.
Don't know if i'm clear sorry :)
What I have tried:
percent_wins = (Double.Parse(string) / (Double.Parse(string) + Double.Parse(string))) * 100;
推荐答案
Quote:
如何让我的程序在计算过程中不冻结?
How do I make my program not freeze during calculs ?
1解决方案是显着优化代码。
1 Solution is to optimize dramatically that code.
percent_wins = (Double.Parse(string) / (Double.Parse(string) + Double.Parse(string))) * 100;
要
To
WhatEver = (Double.Parse(string);
percent_wins = (WhatEver / (WhatEver + WhatEver)) * 100;
然后到
Then to
WhatEver = (Double.Parse(string);
percent_wins = (WhatEver / (2 * WhatEver)) * 100;
然后到
Then to
WhatEver = (Double.Parse(string);
percent_wins = (1 / 2 ) * 100;
然后到
Then to
percent_wins = 100 / 2;
然后到
Then to
percent_wins = 50;
这正是你的代码行所做的。它不应该再冻结。
This is exactly what your line of code is doing. It shouldn't freeze anymore.
这篇关于如何让我的程序在计算过程中不冻结?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!