مشاهده نسخه کامل
: درخواست کد ماشین حساب
Senator_Offline
02-04-2009, 22:35
سلام من نه رشتم کامپیوتره نه نیازی به یاد گیری برنامه نویسی دارم به عنوان یک تکلیف اجباری مدرسه باید برنامه ماشین حسابی بنویسم که معمولی باشه نه مهندسی و ناقص نباشه 1 هفته مهلت دارم کمک کنید:40:{ویژوال بیسیک 6}
roya_borhany
08-04-2009, 17:53
Dim bank, s
Dim sum, men, ta, zarb, dat, M As Boolean
Private Sub c_Click()
s = Text1.Text
End Sub
Private Sub Command11_Click()
If dat = False Then
Text1.Text = Text1.Text + "."
dat = True
End If
End Sub
Private Sub Command1_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 Command2_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 Command3_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 Command4_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 Command5_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 Command6_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 Command7_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 Command8_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 Command9_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
Private Sub Command10_Click()
If M = True Then
Text1.Text = ""
M = False
End If
If Text1.Text = "0" Then
Text1.Text = "0"
Exit Sub
End If
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command17_Click()
Text1.Text = ""
bank = 0
sum = False
men = False
ta = False
zarb = False
dat = False
M = False
End Sub
Private Sub Command16_Click()
If sum = True Then
bank = bank + Val(Text1.Text)
Text1.Text = ""
Exit Sub
End If
sum = True
men = False
ta = False
zarb = False
dat = False
If Val(Text1.Text) = 0 Then
Exit Sub
End If
bank = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub Command15_Click()
If men = True Then
bank = bank - Val(Text1.Text)
Text1.Text = ""
Exit Sub
End If
men = True
sum = False
ta = False
zarb = False
dat = False
If Val(Text1.Text) = 0 Then
Exit Sub
End If
bank = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub Command14_Click()
If ta = True Then
bank = bank / Val(Text1.Text)
Text1.Text = ""
Exit Sub
End If
ta = True
sum = False
men = False
zarb = False
dat = False
If Val(Text1.Text) = 0 Then
Exit Sub
End If
bank = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub Command13_Click()
If zarb = True Then
bank = bank * Val(Text1.Text)
Text1.Text = ""
Exit Sub
End If
zarb = True
sum = False
men = False
ta = False
dat = False
If Val(Text1.Text) = 0 Then
Exit Sub
End If
bank = Val(Text1.Text)
Text1.Text = ""
End Sub
Private Sub Command12_Click()
If sum = True Then
Text1.Text = bank + Val(Text1.Text)
sum = False
End If
If men = True Then
Text1.Text = bank - Val(Text1.Text)
men = False
End If
If ta = True Then
If Val(Text1.Text) = 0 Then
ta = False
Text1.Text = "Cannot divide by zero"
Exit Sub
End If
Text1.Text = bank / Val(Text1.Text)
ta = False
End If
If zarb = True Then
Text1.Text = bank * Val(Text1.Text)
zarb = False
End If
zarb = False
sum = False
men = False
ta = False
dat = True
M = True
bank = 0
این برنامه رو از اینترنت گرفتم اگه نفهمیدی بگو که یکی هم خودم نوشتم البته زیاد روش کار نکردم. کاملش کنم و برات بذارم
ar.constantine
11-04-2009, 20:48
با سلام
من اين برنامه رو خودم نوشتم، لينك دانلودش رو براتون ميذارم:
اگر مشكلي داشت حتما بگو!!!!!!
ar.constantine@yahoo.com
اينم لينك :
برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
moshaveran
12-04-2009, 08:20
من این ماشن حساب رو با vb.net نوشتم می تونی بعضی از کداشو به vb تغییر بدی ولی این حسن داره که مو لا درزش نمی ره
Public Class form1
Dim a, b, c As Byte
Dim x As Single
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "1"
a = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "2"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "3"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "4"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "5"
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "6"
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "7"
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "8"
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "9"
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If (TextBox1.Text = "0") Or (a = 1) Then
x = CSng(TextBox1.Text)
TextBox1.Clear()
a = 0
End If
If a = 3 Then
TextBox1.Clear()
a = 0
End If
TextBox1.Text = TextBox1.Text & "0"
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
If ((InStr(TextBox1.Text, ".")) = 0) Then
TextBox1.Text = TextBox1.Text & "."
End If
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
TextBox1.Text = "0"
c = 1
b = 0
x = 0
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
If c = 1 Then
x = CSng(TextBox1.Text) + 0
c = 0
TextBox1.Text = CStr(x)
b = 1
a = 1
End If
If b = 0 Then
x = CSng(TextBox1.Text) + 0
TextBox1.Text = CStr(x)
b = 1
a = 1
End If
If b = 2 And a = 0 Then
x = x - CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 1
a = 1
End If
If b = 1 And a = 0 Then
x = x + CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 1
a = 1
End If
If b = 3 And a = 0 Then
x = CSng(TextBox1.Text) * x
TextBox1.Text = CStr(x)
b = 1
a = 1
End If
If b = 4 And a = 0 Then
If TextBox1.Text = "0" Then
TextBox1.Text = "ERROR"
a = 3
x = 0
c = 1
b = 0
Else
x = x / CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
End If
End If
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
If b = 1 Then
x = CSng(TextBox1.Text) + x
TextBox1.Text = CStr(x)
b = 0
End If
If b = 2 Then
x = x - CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 0
End If
If b = 3 Then
x = CSng(TextBox1.Text) * x
TextBox1.Text = CStr(x)
b = 0
End If
If b = 4 Then
If TextBox1.Text = "0" Then
TextBox1.Text = "ERROR"
a = 3
x = 0
c = 1
b = 0
Else
x = x / CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
End If
b = 0
End If
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If c = 1 Then
x = CSng(TextBox1.Text) - 0
c = 0
TextBox1.Text = CStr(x)
b = 2
a = 1
End If
If b = 0 Then
x = CSng(TextBox1.Text) - 0
TextBox1.Text = CStr(x)
b = 2
a = 1
End If
If b = 2 And a = 0 Then
x = x - CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 2
a = 1
End If
If b = 1 And a = 0 Then
x = x + CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 2
a = 1
End If
If b = 3 And a = 0 Then
x = CSng(TextBox1.Text) * x
TextBox1.Text = CStr(x)
b = 2
a = 1
End If
If b = 4 And a = 0 Then
If TextBox1.Text = "0" Then
TextBox1.Text = "ERROR"
a = 3
x = 0
c = 1
b = 0
Else
x = x / CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
End If
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
If c = 1 Then
x = CSng(TextBox1.Text) * 1
c = 0
TextBox1.Text = CStr(x)
b = 3
a = 1
End If
If b = 0 Then
x = CSng(TextBox1.Text) * 1
TextBox1.Text = CStr(x)
b = 3
a = 1
End If
If b = 2 And a = 0 Then
x = x - CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 3
a = 1
End If
If b = 1 And a = 0 Then
x = x + CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 3
a = 1
End If
If b = 3 And a = 0 Then
x = CSng(TextBox1.Text) * x
TextBox1.Text = CStr(x)
b = 3
a = 1
End If
If b = 4 And a = 0 Then
If TextBox1.Text = "0" Then
TextBox1.Text = "ERROR"
a = 3
x = 0
c = 1
b = 0
Else
x = x / CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
End If
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
c = 1
End Sub
Private Sub Button14_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
If c = 1 Then
x = CSng(TextBox1.Text) / 1
c = 0
TextBox1.Text = CStr(x)
b = 4
a = 1
End If
If b = 0 Then
x = CSng(TextBox1.Text) / 1
TextBox1.Text = CStr(x)
b = 4
a = 1
End If
If b = 2 And a = 0 Then
x = x - CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 4
a = 1
End If
If b = 1 And a = 0 Then
x = x + CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
b = 4
a = 1
End If
If b = 3 And a = 0 Then
x = CSng(TextBox1.Text) * x
TextBox1.Text = CStr(x)
b = 4
a = 1
End If
If b = 4 And a = 0 Then
If TextBox1.Text = "0" Then
TextBox1.Text = "ERROR"
a = 3
x = 0
c = 1
b = 0
Else
x = x / CSng(TextBox1.Text)
TextBox1.Text = CStr(x)
End If
End If
End Sub
End Class
vBulletin , Copyright ©2000-2025, Jelsoft Enterprises Ltd.