Wednesday, July 27, 2011

Qbasic (Find the Current Month)

Declare Function curmth$(n$())
CLS
DIM n$(12)
For J = 1 to 12
READ N$(J)
NEXT
M$ = Curmth$(N$())
Print "Current system month is "; M$
Data Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sept, Oct, Nov, Dec
End

Function Curmth$(N$())
D$ = Date$
N = Val (Left$(D$,2)
For M = 1 to 12
If N=K then
Z$ = N$(K)
ENDIF
NEXT
CURMTH$ = Z$
END FUNCTION

1 comment: