PDA

View Full Version : ماشین حساب



nastaran_s
سه شنبه 27 آذر 1386, 10:56 صبح
سلام دوستان.در برنامه ماشین حساب اگه بخوام عمل تقسیم و تفریق چند عدد فقط با زدن یکبار = جواب بده باید چکار کنم ؟

VisualStudio
سه شنبه 27 آذر 1386, 12:26 عصر
من مشکل شما را متوجه نشدم اما فکر کنم شما می تونید با استفاده از آرایه ها این کار را بکیند

ice007
سه شنبه 27 آذر 1386, 13:16 عصر
روش حل در کتابهای ساختمان داده ها وجود دارند.

amirsajjadi
چهارشنبه 28 آذر 1386, 07:05 صبح
درسته ؛ کاربر ice007 درست میگن با استفاده از perfix کردن اون عبارت با استفاده از استک یا صف میتونید این کار رو انجام بدید
البته اگر بخواین توی برنامتون اولویت پرانتز و عملگرها هم محاسبه بشه میتونید از این روشی که گفتم استفاده کنید وگرنه از روش کاربر visualstudio میتونید استفاده کنید

Evil 69
چهارشنبه 28 آذر 1386, 14:17 عصر
سلام
برای چی این قدر بمده خدا رو میپیچونین .
شما میتونی وقتی که +-*/ و ... رو میزنی حاصل اون رو در یک متغیر بریزی و بعد از اینکه کاربر = رو زد اون متغیر رو نشون بدی
البته باید برای * باید یک شرط بذاری که مقدار null وارد نشده باشه و همین طور برای / باید چک کنی تا مخرج تقسیم 0 نباشه

ice007
چهارشنبه 28 آذر 1386, 15:57 عصر
بله این در صورتیه که بحث اولویت عملگرها و پرانتز و ... در میان نباشد

nastaran_s
چهارشنبه 28 آذر 1386, 18:17 عصر
من از راهکار evil69 استفاده کرده بودم البته برب +و* ولی برای-و/نتونستم.
اومدم برای عملیات+و... تابع نوشتم که هروقت +و...کلیک کردم تابع صدا بزنه اما برای= مشکل پیش میاد اگر بخوام 4+5*6/7 انجام بده فقط5*6/7انجام میده

Ner'zhul Arthas
چهارشنبه 28 آذر 1386, 18:44 عصر
کدتون رو بذارید ببینیم چشه.

roghayyeh
پنج شنبه 29 آذر 1386, 17:04 عصر
برنامه ماشین حساب مهندسی

hosseinhossein
پنج شنبه 13 دی 1386, 14:17 عصر
با سلام :
عزیز ببین که بدردت میخوره در همون حد /*+





Public Class Form6

Dim KeyAscii As Integer
Dim bank, s
Dim sum, men, ta, zarb, dat, M As Boolean





Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "1"
Exit Sub
End If
Text1.Text = Text1.Text + "1"
End Sub









Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "2"
Exit Sub
End If
Text1.Text = Text1.Text + "2"
End Sub








Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "3"
Exit Sub
End If
Text1.Text = Text1.Text + "3"
End Sub









Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "4"
Exit Sub
End If
Text1.Text = Text1.Text + "4"
End Sub













Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "5"
Exit Sub
End If
Text1.Text = Text1.Text + "5"
End Sub










Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "6"
Exit Sub
End If
Text1.Text = Text1.Text + "6"
End Sub











Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "7"
Exit Sub
End If
Text1.Text = Text1.Text + "7"
End Sub









Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "8"
Exit Sub
End If
Text1.Text = Text1.Text + "8"
End Sub









Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "9"
Exit Sub
End If
Text1.Text = Text1.Text + "9"
End Sub