<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Округление числа.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13068&amp;type=atom" />
	<updated>2017-10-07T12:19:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13068</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление числа.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119877#p119877" />
			<content type="html"><![CDATA[<p>Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[aktor311]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38738</uri>
			</author>
			<updated>2017-10-07T12:19:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119877#p119877</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление числа.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119875#p119875" />
			<content type="html"><![CDATA[<p>Целочисленное деление осуществляется через два слэша(//). Почитайте об этом <a href="http://www.script-coding.com/AutoHotkey/Variables.1.0.46.07.html">здесь</a>. Остаток от деления делимого на делитель, возвращает функция Mod(). Округление числа до нужной точности после запятой - Round(). О последних двух почитайте <a href="http://www.script-coding.com/AutoHotkey/Functions.html">тут</a>.</p><p>И пользуйтесь поиском. Все эти знания ни от кого не скрывают.<br /></p><div class="codebox"><pre><code>
k := 2000			; Капитал
r := 10				; Процент
r := r / 100
result := 17000		; Ожидаемый результат
months := 0
while (k &lt; result) {
	k += k * r
	months++
}
MsgBox,,Title,% &quot;Для роста капитала до &quot; result &quot; потребуется &quot; months &quot; месяц/цев/ца, или &quot; months//12 &quot; год/года/лет. А если быть чуть точнее, то &quot; Round(months/12,2) &quot; год(года)/лет&quot;
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[KusochekDobra]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33846</uri>
			</author>
			<updated>2017-10-07T10:57:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119875#p119875</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление числа.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119874#p119874" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
var := Round(var2) ; автоматическое округление
var := Ceil(var2) ; округление в большую сторону
var := Floor(var2) ; округление в меньшую сторону</code></pre></div>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-10-07T10:50:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119874#p119874</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Округление числа.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119873#p119873" />
			<content type="html"><![CDATA[<p>Как округлить полученное число до целых?<br />Допустим<br /></p><div class="codebox"><pre><code>l=0

Gui, Add, ListBox, x2 y0 w230 h420 vDm, 
Gui, Add, Button, x66 y430 w100 h30 gSave, Запуск
Gui, Show, w236 h470, 
return

Save:
GuiControl,, Dm, Запущено

Input, Капитал, V, {sc1C}
k:=Капитал
GuiControl,, Dm, Капитал в %k% рублей

Input, Рост, V, {sc1C}
r:=Рост
GuiControl,, Dm, Рост %r% процентов

Input, Сумма, V, {sc1C}
s:=Сумма
GuiControl,, Dm, %s% рублей

Loop {
	if (k&lt;s)
		k:=k+(k*(r/100)) &amp;&amp; l++
	if (k&gt;=s)
		break
}
l:=l/12

GuiControl,, Dm, Через %l% лет(года).
return
GuiClose:
ExitAppp</code></pre></div><p>Тут я получаю l в месяцах, потом l/12 и получаются года. Как округлить конечный l до целых?<br />И есть ошибка в этой строчке<br /></p><div class="codebox"><pre><code>if (k&lt;s)
		k:=k+(k*(r/100)) &amp;&amp; l++</code></pre></div><p>Не могу понять в чем проблема.</p>]]></content>
			<author>
				<name><![CDATA[aktor311]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38738</uri>
			</author>
			<updated>2017-10-07T10:10:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119873#p119873</id>
		</entry>
</feed>
