gpt4 book ai didi

c# - operator * 不能应用于 decimal 和 double c#

转载 作者:行者123 更新时间:2023-11-30 14:22:56 28 4
gpt4 key购买 nike

<分区>

我目前正在制作一个读入 CSV 文件并生成人员和账户余额列表的税务程序(研究项目),我需要从一个文本框中舍入 2 位小数并将它们加到另一个文本框中.我附加的代码告诉我我不能使用“*”我如何用 0.1 乘以小数?如果我做错了,请告诉我,干杯!

public partial class Form1 : Form
{
//CSV ARRAY LISTS
List<string> fullName = new List<string>();
List<string> accBalance = new List<string>();

int currentItem;
int index;
int counter = 0;

decimal interestBalance = 0;
decimal result;

decimal interestRemainder = 0;
double round = 0.1;


private void interestBalanceBox_TextChanged(object sender, EventArgs e)
{
interestRemainder = decimal.Parse(interestBalanceBox.Text);
interestRemainder = Math.Truncate(0.1 * interestRemainder) / 100;
interestRemainderBox.Text = interestRemainder.ToString();

}

我们要代表的程序就是这里的程序!任何帮助将不胜感激。

enter image description here

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com