Цитата:
messagebox(shorten_price(10000));
function floor_division(int x, int y)
{
int quotient = 0;
while(x>=y) {x = x - y; quotient++;}
return quotient;
}
function shorten_price(int price)
{
if (price < 1000) return format(price);
if(modulo(price, 500) != 0) return format(price);
if(price < 1000000) return format(floor_division(price, 1000)) + "к";
return format(floor_division(price, 1000000)) + "кк";
}
function modulo(int x, int y)
{
while(x>=y) x = x - y;
return x;
}
ок:
CODE:
messagebox(shorten_price(10000));
function floor_division(int x, int y)
{
int quotient = 0;
while(x>=y) {x = x - y; quotient++;}
return quotient;
}
function shorten_price(int price)
{
if (price < 1000) return format(price);
if(modulo(price, 500) != 0) return format(price);
if(price < 1000000) {int re=floor_division(price, 1000); return format(re) + "к";}
return format(floor_division(price, 1000000)) + "кк";
}
function modulo(int x, int y)
{
while(x>=y) x = x - y;
return x;
}
function floor_division(int x, int y)
{
int quotient = 0;
while(x>=y) {x = x - y; quotient++;}
return quotient;
}
function shorten_price(int price)
{
if (price < 1000) return format(price);
if(modulo(price, 500) != 0) return format(price);
if(price < 1000000) {int re=floor_division(price, 1000); return format(re) + "к";}
return format(floor_division(price, 1000000)) + "кк";
}
function modulo(int x, int y)
{
while(x>=y) x = x - y;
return x;
}
в любом случае - в справке есть битые ссылки, например для return