www.91084.com

GVKun编程网logo

货币计算(货币计算器)

12

在本文中,我们将带你了解货币计算在这篇文章中,我们将为您详细介绍货币计算的方方面面,并解答货币计算器常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的c#–货币缩写(EUR,USD,GBP)兑

在本文中,我们将带你了解货币计算在这篇文章中,我们将为您详细介绍货币计算的方方面面,并解答货币计算器常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的c# – 货币缩写(EUR,USD,GBP)兑换货币符号(€,$,£)、Discord.py 货币系统赚取随机货币、Facebook正全面启动虚拟货币计划 吸引玩家、html5输入货币/货币

本文目录一览:

货币计算(货币计算器)

货币计算(货币计算器)

   NSDecimalNumber *userNum = [NSDecimalNumber decimalNumberWithString:@"0.1"];

            

            NSDecimalNumber *userMoney = [multiplierAll decimalNumberByMultiplyingBy:userNum];//优惠金额

            NSString *v1 = [userMoney stringValue];

            

            NSDecimalNumber *shengpai = [multiplierAll decimalNumberBySubtracting:userMoney];// 总额 - 优惠

            NSString *a1 = [shengpai stringValue];

            

            NSDecimalNumber *shengyou = [multiplicandSpecial decimalNumberBySubtracting:userMoney];

            NSString *s1 = [shengyou stringValue];

货币计算 最好用NSDecimalNumber进行科学计数

总的来说,对于货币计算,应该需要注意精度的问题。同时在运算的时候,应该优先选用框架提供的API,否则,就应该使用足够精度的类型运算,同时对自己写的接口进行足够的说明,要求开发者按照规范来使用。

在自己不能保证足够准确的情况下,用适当的说明的要求来规避责任还是可以接受的。至少被人抱怨两句总比出错强。

iOS开发中,和货币价格计算相关的,需要注意计算精度的问题。即使只是两位小数,也会出现误差。使用float类型运算,是完全不够的。经过一番测试,最后选择使用系统提供的APINSDecimalNumber来进行更好的解决。

c# – 货币缩写(EUR,USD,GBP)兑换货币符号(€,$,£)

c# – 货币缩写(EUR,USD,GBP)兑换货币符号(€,$,£)

我有一些带有货币缩写的下拉框,如欧元,美元,英镑和所有其他货币.我想使用一些c#.Net功能/方法,我可以插入货币缩写,然后返回货币符号(€,$,£).

我希望有一个人可以帮助我.

解决方法

框架中没有任何内容可以专门处理这个问题,但您可以使用 Dictionary的货币缩写和符号来解决它.

Discord.py 货币系统赚取随机货币

Discord.py 货币系统赚取随机货币

如何解决Discord.py 货币系统赚取随机货币?

所以我试图制作一个经济机器人,用户可以先注册以创建一个帐户,这样他们就可以成为经济系统的一部分,现在我试图通过让机器人随机给出赚钱命令在 5 分钟的冷却时间内向发送命令的用户赚取收入,然后我遇到了一个错误,即赚钱命令没有按预期工作,这是完整的代码,问题出在 (getprimo) 上:

@client.command(pass_context=True)
async def wallet(ctx):
    id = str(ctx.message.author.id)
    if id in amounts:
        em1 = discord.Embed(title = f''Wallet'',description = "You have {} <:primogem:853895082646044672> in paimon bank <:_Paimon6:827074349450133524>.".format(amounts[id]),color= ctx.author.color)
        await ctx.send(embed = em1)
    else:
        em2 = discord.Embed(title = f''Account Not Registered'',description = f''You do not have an account <:_pBaffled:827075083670650950>.\nUse %register to make an account.'',color= ctx.author.color)
        await ctx.send(embed = em2)


@client.command(pass_context=True)
async def register(ctx):
    id = str(ctx.message.author.id)
    if id not in amounts:
        amounts[id] = 100
        em3 = discord.Embed(title = f''Account Successfully Registered'',description = f''You are Now registered  <:_Paimon6:827074349450133524>.'',color= ctx.author.color)
        await ctx.send(embed = em3)
        _save()
    else:
        em4 = discord.Embed(title = f''Account Already Registered'',description = f''You already have an account <:_pBaffled:827075083670650950>.'',color= ctx.author.color)
        await ctx.send(embed = em4)


@client.command(pass_context=True)
async def send(ctx,other: discord.Member,amount: int):
    primary_id = str(ctx.message.author.id)
    other_id = str(other.id)
    if primary_id not in amounts:
        em5 = discord.Embed(title = f''Account Not Registered'',color= ctx.author.color)
        await ctx.send(embed = em5)
    elif other_id not in amounts:
        em6 = discord.Embed(title = f''Account Not Registered'',description = f''You cant send <:primogem:853895082646044672> to someone that does not have an account.\nTell the person to use %register first in order to send the <:primogem:853895082646044672>.'',color= ctx.author.color)
        await ctx.send(embed = em6)
    elif amounts[primary_id] < amount:
        em7 = discord.Embed(title = f''Not Enough Primogems'',description = f''Insufficient <:primogem:853895082646044672>.\nCant send <:primogem:853895082646044672> to {other.mention} <:_pHug:827086739435683840>.'',color= ctx.author.color)
        await ctx.send(embed = em7)
    else:
        amounts[primary_id] -= amount
        amounts[other_id] += amount
        em8 = discord.Embed(title = f''Send Successful'',description = f''Done sending {amount} <:primogem:853895082646044672> to {other.mention} <:_Paimon6:827074349450133524>.'',color= ctx.author.color)
        await ctx.send(embed = em8)
        _save()

@client.command(pass_context=True)
@commands.cooldown(1,300,commands.BucketType.user)
async def getprimo(ctx):
    id = str(ctx.message.author.id)
    amount = random.randrange(0,100)
    amounts[id] += amount
    em9 = discord.Embed(title = f''Primogems Earned'',description = f''You get {amount} <:primogem:853895082646044672>.\nPlease wait 5 minutes to get more primo <:_Paimon6:827074349450133524>.'',color= ctx.author.color)
    await ctx.send(embed = em9)
    _save()

def _save():
    with open(''amounts.json'',''w+'') as f:
        json.dump(amounts,f)

@client.command()
async def save():
    _save()

任何帮助将不胜感激,谢谢。

解决方法

好的,我终于找到了答案,抱歉之前问过这个问题。如果你想知道,这里是我之前遇到的问题的固定代码。我在那里更改了“金额”和“id”,因为之前只是一个测试。

@client.command(pass_context=True)
@commands.cooldown(1,300,commands.BucketType.user)
async def getprimo(ctx):
    primaryid = str(ctx.message.author.id)
    earning = random.randint(0,100)
    amounts[primaryid] += earning
    em9 = discord.Embed(title = f''Primogems Earned'',description = f''You get {earning} <:primogem:853895082646044672>.\nPlease wait 5 minutes to get more primo <:_Paimon6:827074349450133524>.'',color= ctx.author.color)
    await ctx.send(embed = em9)
    _save()

我之前使用的是 random.randint 而不是 random.randrange,这就是命令不起作用的原因。

Facebook正全面启动虚拟货币计划 吸引玩家

Facebook正全面启动虚拟货币计划 吸引玩家

据国外媒体报道,社交网站Facebook拥有4亿用户,如果把其比作一个王国,它将是世界上第三人口大国。因此,Facebook想拥有自己的货币 体系一点也不令人感到奇怪。Facebook正在全面启动虚拟货币Facebook Credits计划。玩家可以使用虚拟货币Facebook Credits来支付购买Farmville应用程序和Mafia Wars应用程序的费用。主流应用程序开发商正在测试这套系统的beta个人版。

专家认为,玩家更喜欢将现金送给Facebook网站,而不是一个素未谋面的应用程序开发商,因 此,这种新货币制度将吸引更多的玩家。同时,对于应用程序开发商来说,虚拟货币Facebook Credits计划也是一个好消息,但是Facebook会提成30%。 Facebook认为, 这一虚拟货币业务在很长时间内很难给他们带来巨额回报。此外,Facebook还会通过各种奖励制度来刺激用户使用虚拟货币Facebook Credits。

html5输入货币/货币

html5输入货币/货币

我似乎无法计算出什么用于接受表单上的货币价值。

我努力了…

<input type="number" min="0" max="10000" step="1" name="broker_Fees" id="broker_fees" required="required">

但是那不会允许便士条目。

我希望增量按钮控制以磅为单位,但仍然需要进入便士的能力。

谁想要使用一次移动1p的增量按钮?

也许我使用错误的控制,但是我找不到钱/货币控制?

有人可以建议使用HTML5接受货币价值(包括逗号,小数位和货币符号)的最佳方式吗?

谢谢,
1DMF

解决方法

为了允许HTML5数字输入上的分数(分),您需要将“step”属性指定为=“any”:
<input type="number" min="1" step="any" />

这将特别使Chrome在输入中输入小数/分数货币时显示错误。 Mozilla,IE等…如果您忘记指定step =“any”,则不会出错。 W3C规范说,确实需要step =“any”才能允许小数。所以,你一定要用它。

此外,数字输入现在得到相当广泛的支持(近90%的用户)。

今天的关于货币计算货币计算器的分享已经结束,谢谢您的关注,如果想了解更多关于c# – 货币缩写(EUR,USD,GBP)兑换货币符号(€,$,£)、Discord.py 货币系统赚取随机货币、Facebook正全面启动虚拟货币计划 吸引玩家、html5输入货币/货币的相关知识,请在本站进行查询。

本文标签: