如何在vb 2008中使用科学计算器中的括号添加代码 [英] how to do the code to add brackets in an scientific calculator in vb 2008

查看:117
本文介绍了如何在vb 2008中使用科学计算器中的括号添加代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hiz我有一个项目要在我的大学里介绍一个科学计算器

我已经完成了所有数字按钮,退格,操作+, - ,*,/和

第一个昏暗的操作为字符串

然后在那些我把操作=+或者......

和等于我的每个按钮中如果操作=+然后a + b

我使用1个文本框

在科学操作中使用txtbox.text = math.sin(txtbox.txt )4例子

我现在需要的唯一按钮是breckts按钮

i试图通过puttint启动txtbox.txt = txtbox.text&(并且没有'工作

i需要用它来表示类似(a + b)* c的等式来表示

PS我不是在大学学习计算机程序而是这个课程因为我正在学习成为一名数学老师,所以我不得不采取所有编码问题

解决方案

这不是一个真正的答案,我希望能够格式化代码...



您发布的代码 - 我的评论......



< pre lang =vb> Txtsolution.Text = Math.Sin(Txtsolution.Text)
' so Txtsoluton .Text现在有最初的任何内容的罪
variable1 = Val(txtsolution.Text)
Txtsolution.Text =
' 现在txtSolution.Text为空
operation = +
variable2 = Val(Txtsolution .Text)
' variable2现在是jsut 0我想,因为Txtsolution.Text是一个空字符串
如果 operation = + 然后
' 操作IS = +因为你只是设置它
resultat = variable1 + variable2
< span class =code-comment>' resultat将是Sin(前面计算的)和0的总和(所以只是Sin值!)
Txtsolution.Text = resultat
' now Txtsolution.Text =计算的Sin值
结束 如果





这对我来说毫无意义 - 我以为你在问一个支架?我在你的代码中看不到任何括号,代码对我来说没有意义(更不用说你的一些代码是一个函数,其余的只是,那里。)



你刚刚复制并粘贴了随机代码,或者这实际上是你程序的一部分吗?


没有那些是程序的例子但是不同的部分

i把罪作为所有数学方程的一个例子,我把它们的代码放了



variable1 = Val(txtsolution.Text)

Txtsolution.Text =

operation =+

i把它放在+按钮



variable2 = Val(Txtsolution.Text)

如果operation =+那么

resultat = variable1 + variable2

Txtsolution.Text = resultat

结束如果

i把它放在=按钮sry我不清楚我如何把代码


hiz i have a project to present in my university about an scientific calculator
I already did all numbers button , the backspace, the operation "+,-,*,/" and that by
1st dim operation as string
then in each button of those i put operation = "+" or ...
and in the equal I put if operation = "+" then a+b
i'am using 1 textbox
in the scientific operation i used txtbox.text=math.sin(txtbox.txt) 4 exemple
the only button i need right now is the breckts button
i tried to start by puttint txtbox.txt= txtbox.text & "(" and that didn't work
i need to used it to put an equation like (a+b)*c for exemple
PS i'am not studying computor programtion in uni but this a course that i have to take since i'am studying to be an math teacher so i'am new to all the coding issue

解决方案

This isn't really an answer but I wanted to be able to format the code ...

Your code you posted - with my comments...

Txtsolution.Text = Math.Sin(Txtsolution.Text)
' so Txtsoluton.Text now has the Sin of whatever was there originally
variable1 = Val(txtsolution.Text)
Txtsolution.Text = ""
' now txtSolution.Text is empty
operation = "+"
variable2 = Val(Txtsolution.Text)
' variable2 is now jsut 0 I guess, as Txtsolution.Text is an empty string
If operation = "+" Then
' operation IS = + because you just set it
    resultat = variable1 + variable2
' resultat will be the sum of the Sin (calculated earlier) and 0 (so just the Sin value!)
    Txtsolution.Text = resultat
   ' now Txtsolution.Text = the Sin value calculated
End If



This makes no sense to me - I thought you were asking about a bracket? I see no bracket in your code, and the code just doesn't make sense to me (not to mention that some of your code is a function and the rest is just, sort of, there.

Have you just copied and pasted random code or is this actually a part of your program?


no those are examples of the program but different part
i put the sin as an example of all the math equation and did i put their code
and
variable1 = Val(txtsolution.Text)
Txtsolution.Text = ""
operation = "+"
i put it it in the + button
and
variable2 = Val(Txtsolution.Text)
If operation = "+" Then
resultat = variable1 + variable2
Txtsolution.Text = resultat
End If
i put it in the = button sry i was not clear about how i put the code


这篇关于如何在vb 2008中使用科学计算器中的括号添加代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆