Thursday, January 14, 2010

Computer Programing For The MIND!

Hey Yall,
So today I was programming in VBA and we came up with some pretty cool programs. Here, you can see we
programed 3 different subroutines, which, If you plug them into your pc's excel program, Visual Basic, will do all sorts of cools things! Like calculate Pi to infinite, find the area of a circle, or find the coordinates of a parabola! Click on the link above(In the title) to see instructions.


Sub 3.14r2()
Dim n As Integer
Dim msg As String
msg = "All Done."
n = InputBox("Enter Radius Value")
Sheets.Add
For n = 1 To n
ActiveSheet.Cells(n, 1) = n
ActiveSheet.Cells(n, 2) = n * 3.14 * n
Next n
MsgBox msg
End Sub

Sub FarinhietCelcius()
Dim n As Double
Dim c As Double
Dim msg As String
msg = "All Done."
n = InputBox("Max Positive Integer")
Sheets.Add
c = 0
n = 21
For n = 1 To n
x = n - 1
c = x * 5
ActiveSheet.Cells(n, 1) = c
ActiveSheet.Cells(n, 2) = c * 9 / 5 + 32
Next n
MsgBox msg
End Sub

Sub xy2()
Dim RW As Double
Dim x As Double
Sheets.Add
RW = 21
For RW = 1 To RW
x = RW - 1
ActiveSheet.Cells(RW, 1) = x ^ 2
ActiveSheet.Cells(RW, 2) = -x
ActiveSheet.Cells(RW, 3) = x
Next RW
End Sub


2 comments:

  1. Whoa.... I mean whoa..... big time.... I have no idea what all of that means. :) You sound very engineer'ish. :)

    ReplyDelete