AS computing

Cie AS Computing

Dear all,

            Welcome to AS computing class. I am Dr.Ravi your facilitator for this course. This course consists of two modules, theory and practicals. In theory we will have 12 chapters and in practicals we do have programming classes. You will sit for theory and practical exams at the end of the course, which is conducted by CIE.

All the best, keep moving, for there is always a helping hand above you to guide you.

Dr.Ravi

 

Views: 3404

Reply to This

Replies to This Discussion

But i think yours gives 11 terms~~ to get 10 terms, then ------ If i=89 then   msgbox...........But it doesn't matter anyway...thx amir...i understand how it works~~ XD

oh ya..you're right dain..i forgot to include the first 1 when counting the number of term...

refined code:

a = 1

2 Form1.Print i

i = a + b 

b = a 

a = i 

If i = 89 Then MsgBox ("cycle complete"): End 

GoTo 2


yeah..can u help me?..



Afifah Ahmad said:

do you mean form1.cls raj?

Raj Kumaran Kalidas said:
Guys, can I know the command how to clear all the data that is stored in the programming system?

make an command button...click on it...then write

form1.cls

when you run the program click the button to clear the data show on form1


Raj Kumaran Kalidas said:

yeah..can u help me?..



Afifah Ahmad said:

do you mean form1.cls raj?

Raj Kumaran Kalidas said:
Guys, can I know the command how to clear all the data that is stored in the programming system?
Raj, u can do like Amir said because I've tried it and it's work..

hahahha for the new sequence dr. ravi gave us i simply typed lots of times like this

Z = Z + 1

A = Z

B = A + Z

C = A + B

D = B + C

E = C + D

F = D + E

G = E + F

H = F + G

I = G + H

J = H + I

K = I + J

Form1.Print A, B, C, D, E, F, G, H, I, J, K

 

its not a very gud solution though huhu

 

yea, i thought of a solution like this too, but it's way too long :/ but then again, it gives us a clearer view of how amir's sequence work :D


Afifah Ahmad said:

hahahha for the new sequence dr. ravi gave us i simply typed lots of times like this

Z = Z + 1

A = Z

B = A + Z

C = A + B

D = B + C

E = C + D

F = D + E

G = E + F

H = F + G

I = G + H

J = H + I

K = I + J

Form1.Print A, B, C, D, E, F, G, H, I, J, K

 

its not a very gud solution though huhu

 

Programming gets more interesting!!! XD

 

Private Sub Command1_Click()

Dim a(10), b(10) As String

Open "c:\phone" For Output As #1

20 i = i + 1

a(i) = InputBox("Enter Name")

b(i) = InputBox("Enter Phone Number")

Write #1, a(i), b(i)

If i = 5 Then Close

GoTo 20

Close



End Sub


Private Sub Command2_Click()
Dim a(10), b(10) As String

Open "c:\phone" For Append As #1

20 i = i + 1

a(i) = InputBox("Enter Name")

b(i) = InputBox("Enter Phone Number")

Write #1, a(i), b(i)

If i = 5 Then Close

GoTo 20

Close


End Sub


Private Sub Command3_Click()
Dim a(10), b(10) As String

Open "c:\phone" For Input As #1

x = InputBox("Please Enter Name")

20 If EOF(1) Then GoTo 70

Form1.Print , "Phone No."

i = i + 1

Input #1, a(i), b(i)

If x = a(i) Then Print b(i): MsgBox "Search Complete": GoTo 70

GoTo 20

70 Close


End Sub

Hmm...i tried to search for a solution for 1 of the questions ( odd/even no.) via google but they gave weird solutions such as using MOD Arithmetic Operator and some 'Boolean' thing

eg.


Dim blnIsOdd As Boolean
blnIsOdd = CLng(Text1.Text) And 1
MsgBox blnIsOdd

 

where the above is entered into a command box, and then u open a text box...type in a number...and it will tell u if it's true(odd number) or false(even number)

 

So i'm not really sure if there is a simpler way of doing this but wht i've done so far is this:

 

Dim i As Integer
Dim a As Integer
Dim odd As Integer
Dim even As Integer

i = i + 1
Form1.Print i
20 i = i + 2
Form1.Print i
a = a + 2
Form1.Print a
x = InputBox("Insert Number")
If x = i Then Print , "Odd": MsgBox "Odd Number": Goto70
If x = a Then Print , "Even": MsgBox "Even Number": Goto70
GoTo 20
70 End

 

However..i keep getting 'Compile Error: Sub or Function not defined'

 

Can anyone help me or tell me what is wrong??? :O Thanks

well, that's actually a funny problem you have, you just forgot to put spacing between "goto" and "70", haha! XD

 

make it like this:

                               If x = i Then Print , "Odd": MsgBox "Odd Number": GoTo 70
                               If x = a Then Print , "Even": MsgBox "Even Number":  GoTo 70

 

but even after you changed that, it still won't work, the values will eventually add up endlessly, so we need to type the value printed to get the messagebox appear, hmm



Dain Razali said:

Hmm...i tried to search for a solution for 1 of the questions ( odd/even no.) via google but they gave weird solutions such as using MOD Arithmetic Operator and some 'Boolean' thing

eg.


Dim blnIsOdd As Boolean
blnIsOdd = CLng(Text1.Text) And 1
MsgBox blnIsOdd

 

where the above is entered into a command box, and then u open a text box...type in a number...and it will tell u if it's true(odd number) or false(even number)

 

So i'm not really sure if there is a simpler way of doing this but wht i've done so far is this:

 

Dim i As Integer
Dim a As Integer
Dim odd As Integer
Dim even As Integer

i = i + 1
Form1.Print i
20 i = i + 2
Form1.Print i
a = a + 2
Form1.Print a
x = InputBox("Insert Number")
If x = i Then Print , "Odd": MsgBox "Odd Number": Goto70
If x = a Then Print , "Even": MsgBox "Even Number": Goto70
GoTo 20
70 End

 

However..i keep getting 'Compile Error: Sub or Function not defined'

 

Can anyone help me or tell me what is wrong??? :O Thanks

solution for 1st question..alhamdulilah

 

Dim x As Integer

x = InputBox("numberlol")

a = 1

If x = a Then MsgBox ("input is odd number"): End

1 a = a + 2

If x = a Then MsgBox ("input is odd number"): End

If Not x = a Then GoTo 70

70 b = b + 2

If x = b Then MsgBox ("input is even number"): End

GoTo 1

dain here should solve your code problem

 

Dim i As Integer

Dim a As Integer


Form1.Print " odd    even"

x = InputBox("Insert Number")

i = 1

Print i

20 i = i + 2

a = a + 2

Form1.Print i, a

If x = i Then MsgBox "Odd Number": End

If x = a Then MsgBox "Even Number": End

GoTo 20

Reply to Discussion

RSS

© 2025   Created by Ravichandran.   Powered by

Report an Issue  |  Terms of Service