简单的 C# 初学者问题
我正在尝试制作一个简单的计算器。我的数字下方出现蓝线,并出现错误“预期方法名称”,
我希望你们能帮助我解决菜鸟提出的简单问题。
finalCmb = .25(1.3(txtAtt.Text+txtStr.Text)+txtDef.Text+txtHp.Text+(.5(txtPray.Text))+(.5(txtSum.Text)));
I am trying to make a simple calculator. I am getting blue line under my numbers with the error "Method Name Expected"
I was hopeing you guys could help me out with my simple question from a noob.
finalCmb = .25(1.3(txtAtt.Text+txtStr.Text)+txtDef.Text+txtHp.Text+(.5(txtPray.Text))+(.5(txtSum.Text)));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须手动放置乘法运算符。没有括号乘法。
25(1.3(te...
应该是25 * (1.3 * (te...
将字符串转换为数字是个好主意。
txtStr.Text
到Double.Parse(txtStr.Text)
You have to manually place multiplication operators. There is no bracket multiplication.
25(1.3(te...
should be25 * (1.3 * (te...
Converting strings to numbers would be a good idea.
txtStr.Text
toDouble.Parse(txtStr.Text)
您需要输入星号来进行乘法运算。
You need to put the asterisk symbol for multiplication.
你的语法是错误的。当您执行此操作时,编译器认为您由于左括号而试图调用一个方法,
我不确定您实际上想用它来完成什么,但这没有意义。我建议花更多时间学习基础知识。
Your syntax is wrong. The compiler thinks that you are trying to call a method due to the opening parentheses when you do this
I'm not sure what you are actually trying to accomplish with that, but it doesn't make sense. I would suggest spending some more time learning the basics.