REM PROGRAM TO CHECK
ENTERED NUMBER IS UPPERCASE OR LOWERCASE
CLS
INPUT “Enter a
letter”;A$
U$=UCASE$(A$)
IF U$=A$ THEN
PRINT “It is capital
letter”
ELSE
PRINT “It is small
letter”
ENDIF
END
USING
DECLARE FUNCTION PROCEDURE
DECLARE FUNCTION UC$
(A$)
CLS
INPUT “Enter a
letter”; A$
PRINT UC$(A$)
END
FUNCTION UC$ (A$)
CH$ = UCASE$(A$)
IF A$ = CH$ THEN
UC$ = “It is capital
letter”
ELSE
UC$ = “It is small
letter”
END IF
END FUNCTION
USING
DECLARE SUB PROCEDURE
DECLARE SUB UC(A$)
CLS
INPUT “Enter a
letter”; A$
CALL UC(A$)
END
SUB UC(A$)
CH$ = UCASE$(A$)
IF A$ = CH$ THEN
PRINT “It is capital
letter”
ELSE
PRINT “It is small
letter”
END IF
END SUB
Program to
check a given number is palindrome or not in qbasic
CLS
INPUT “ENTER A
NUMBER”; N
S = N
WHILE N <> 0
A = N MOD 10
R = R * 10 + A
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “THE GIVEN
NUMBER IS PALINDROME”
ELSE
PRINT “IT IS NOT
PALINDROME”
END IF
Using
Declare Sub Procedure
DECLARE SUB A (N)
CLS
INPUT “ENTER A NUMBER”; N
CALL A(N)
END
SUB A (N)
S = N
WHILE N <> 0
B = N MOD 10
R = R * 10 + B
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “IT IS PALINDROME”
ELSE
PRINT “IT IS NOT PALINDROME”
END IF
END SUB
Program to
check a given string is palindrome or not in qbasic
CLS
INPUT “ENTER A STRING”; S$
FOR I = LEN(S$) TO 1 STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
IF S$ = REV$ THEN
PRINT “THE GIVEN STRING IS PALINDROME”
ELSE
PRINT “IT IS NOT PALINDROME”
END IF
Using
declare sub
DECLARE SUB A(S$)
CLS
INPUT “ENTER A STRING”; S$
CALL A(S$)
END
SUB A(S$)
FOR I = LEN(S$) TO 1 STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
IF S$ = REV$ THEN
PRINT “THE GIVEN STRING IS PALINDROME”
ELSE
PRINT “IT IS NOT PALINDROME”
END IF
END SUB
Program to
check given number is armstrong or not in qbasic
CLS
INPUT “ENTER A NUMBER”; N
S = N
WHILE N <> 0
A = N MOD 10
R = R + A ^ 3
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “THE GIVEN NUMBER IS ARMSTRONG”
ELSE
PRINT “IT IS NOT ARMSTRONG”
END IF
Using
declare sub procedure
DECLARE SUB A(N)
CLS
INPUT “ENTER A NUMBER”; N
CALL A(N)
END
SUB A(N)
S=N
WHILE N <> 0
B = N MOD 10
R = R + B ^ 3
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “THE GIVEN NUMBER IS ARMSTRONG”
ELSE
PRINT “IT IS NOT ARMSTRONG”
END IF
END SUB
Program to
reverse a given number in qbasic
CLS
INPUT “ENTER A NUMBER”; N
WHILE N <> 0
A = N MOD 10
R = R * 10 + A
N = FIX(N / 10)
WEND
PRINT R
END
Using
declare sub procedure
DECLARE SUB A(N)
CLS
INPUT “ENTER A NUMBER”; N
CALL A(N)
END
SUB A(N)
WHILE N <> 0
B = N MOD 10
R = R * 10 + B
N = FIX(N / 10)
WEND
PRINT R
END SUB
Using declare
function procedure
DECLARE FUNCTION
A(N)
CLS
INPUT “ENTER A
NUMBER”; N
PRINT A(N)
END
FUNCTION A(N)
WHILE N <> 0
B = N MOD 10
R = R * 10 + B
N = FIX(N / 10)
WEND
A=R
END FUNCTION
Program to
convert decimal to hexadecimal in qbasic
‘THIS PROGRAM CONVERTS
DECIMAL NUMBER INTO HEXADECIMAL
CLS
INPUT “ENTER A
DECIMAL VALUE”; N
WHILE N <> 0
K = N MOD 16
IF K = 10 THEN
B$ = “A”
ELSEIF K = 11 THEN
B$ = “B”
ELSEIF K = 12 THEN
B$ = “C”
ELSEIF K = 13 THEN
B$ = “D”
ELSEIF K = 14 THEN
B$ = “E”
ELSEIF K = 15 THEN
B$ = “F”
ELSE
B$ = STR$(K)
END IF
H$ = B$ + H$
N = FIX(N / 16)
WEND
PRINT “HEXADECIMAL
VALUE IS “; H$
END
Using
declare function procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER INTO HEXADECIMAL
DECLARE FUNCTION Z$
(N)
CLS
INPUT “ENTER A
DECIMAL VALUE”; N
PRINT “HEXADECIMAL
VALUE IS “; Z$(N)
END
FUNCTION Z$ (N)
WHILE N <> 0
K = N MOD 16
IF K = 10 THEN
B$ = “A”
ELSEIF K = 11 THEN
B$ = “B”
ELSEIF K = 12 THEN
B$ = “C”
ELSEIF K = 13 THEN
B$ = “D”
ELSEIF K = 14 THEN
B$ = “E”
ELSEIF K = 15 THEN
B$ = “F”
ELSE
B$ = STR$(K)
END IF
H$ = B$ + H$
N = FIX(N / 16)
WEND
Z$ = H$
END FUNCTION
Using
declare sub procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER INTO HEXADECIMAL
DECLARE SUB Z (N)
CLS
INPUT “ENTER A
DECIMAL VALUE”; N
CALL Z(N)
END
SUB Z (N)
WHILE N <> 0
K = N MOD 16
IF K = 10 THEN
B$ = “A”
ELSEIF K = 11 THEN
B$ = “B”
ELSEIF K = 12 THEN
B$ = “C”
ELSEIF K = 13 THEN
B$ = “D”
ELSEIF K = 14 THEN
B$ = “E”
ELSEIF K = 15 THEN
B$ = “F”
ELSE
B$ = STR$(K)
END IF
H$ = B$ + H$
N = FIX(N / 16)
WEND
PRINT “HEXADECIMAL
VALUE IS “; H$
END SUB
Program to
convert decimal to octal in qbasic
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO Octal
CLS
INPUT “ENTER A
NUMBER”; N
WHILE N <> 0
A = N MOD 8
B$ = STR$(A)
N = FIX(N /
C$ = B$ + C$
WEND
PRINT “QUAINARY
EQUIVALENT IS”; C$
END
Using declare
sub procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO Octal
DECLARE SUB O(N)
CLS
INPUT “ENTER A
NUMBER”; N
CALL O(N)
END
SUB O(N)
WHILE N <> 0
A = N MOD 8
B$ = STR$(A)
N = FIX(N /
C$ = B$ + C$
WEND
PRINT “QUAINARY
EQUIVALENT IS”; C$
END SUB
Using declare
function procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO Octal
DECLARE FUNCTION
O$(N)
CLS
INPUT “ENTER A
NUMBER”; N
PRINT “QUAINARY
EQUIVALENT IS”; O$(N)
END
FUNCTION O$(N)
WHILE N <> 0
A = N MOD 8
B$ = STR$(A)
N = FIX(N /
C$ = B$ + C$
WEND
O$=C$
END FUNCTION
Program to
reverse a given string in qbasic
CLS
INPUT “ENTER A
STRING”; S$
FOR I = LEN(S$) TO 1
STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
PRINT REV$
END
Using declare sub
procedure
DECLARE SUB A(S$)
CLS
INPUT “ENTER A
STRING”; S$
CALL A(S$)
END
SUB A(S$)
FOR I = LEN(S$) TO 1
STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
PRINT REV$
END SUB
Using
declare function procedure
DECLARE FUNCTION A$
(S$)
CLS
INPUT “ENTER A
STRING”; S$
PRINT A$(S$)
END
FUNCTION A$ (S$)
FOR I = LEN(S$) TO 1
STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
A$ = REV$
END FUNCTION
Program to
converts Hexadecimal to Decimal in Qbasic
‘THIS PROGRAM
CONVERTS HEXADECIMAL TO DECIMAL
CLS
INPUT “ENTER
HEXADECIMAL VALUE”;B$
FOR I=LEN(B$) TO 1
STEP -1
A$=MID$(B$,I,1)
C=VAL(A$)
IF A$=”A” THEN C=10
IF A$=”B” THEN C=11
IF A$=”C” THEN C=12
IF A$=”D” THEN C=13
IF A$=”E” THEN C=14
IF A$=”F” THEN C=15
H=H+C*16^P
P=P+1
NEXT I
PRINT “DECIMAL VALUE
IS”;H
END
Using
declare function procedure
‘THIS PROGRAM
CONVERTS HEXADECIMAL TO DECIMAL
DECLARE FUNCTION
Z(B$)
CLS
INPUT “ENTER
HEXADECIMAL VALUE”;B$
PRINT “DECIMAL VALUE
IS”;Z(B$)
END
FUNCTION Z(B$)
FOR I=LEN(B$) TO 1
STEP -1
A$=MID$(B$,I,1)
C=VAL(A$)
IF A$=”A” THEN C=10
IF A$=”B” THEN C=11
IF A$=”C” THEN C=12
IF A$=”D” THEN C=13
IF A$=”E” THEN C=14
IF A$=”F” THEN C=15
H=H+C*16^P
P=P+1
NEXT I
Z=H
END FUNCTION
Using
declare sub procedure
‘THIS PROGRAM
CONVERTS HEXADECIMAL TO DECIMAL
DECLARE SUB Z(B$)
CLS
INPUT “ENTER
HEXADECIMAL VALUE”;B$
CALL Z(B$)
END
SUB Z(B$)
FOR I=LEN(B$) TO 1
STEP -1
A$=MID$(B$,I,1)
C=VAL(A$)
IF A$=”A” THEN C=10
IF A$=”B” THEN C=11
IF A$=”C” THEN C=12
IF A$=”D” THEN C=13
IF A$=”E” THEN C=14
IF A$=”F” THEN C=15
H=H+C*16^P
P=P+1
NEXT I
PRINT “DECIMAL VALUE
IS”;H
END SUB
Program to
convert decimal to binary in qbasic
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO BINARY
CLS
INPUT “ENTER A
NUMBER”; N
WHILE N <> 0
A = N MOD 2
B$ = STR$(A)
N = FIX(N / 2)
C$ = B$ + C$
WEND
PRINT “BINARY
EQUIVALENT IS”; C$
END
Using
declare sub procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO BINARY
DECLARE SUB A (N)
CLS
INPUT “ENTER A
NUMBER”; N
CALL A(N)
END
SUB A (N)
WHILE N <> 0
E = N MOD 2
B$ = STR$(E)
N = FIX(N / 2)
C$ = B$ + C$
WEND
PRINT “BINARY
EQUIVALENT IS”; C$
END SUB
Using
declare function procedure
‘THIS PROGRAM
CONVERTS DECIMAL NUMBER TO BINARY
DECLARE FUNCTION A$
(N)
CLS
INPUT “ENTER A
NUMBER”; N
PRINT “BINARY
EQUIVALENT IS”; A$(N)
END
FUNCTION A$ (N)
WHILE N <> 0
E = N MOD 2
B$ = STR$(E)
N = FIX(N / 2)
C$ = B$ + C$
WEND
A$=C$
END FUNCTION
Program to
convert Binary to Decimal in qbasic
‘THIS PROGRAM CONVERTS BINARY
NUMBER TO DECIMAL
CLS
INPUT “ENTER A BINARY NUMBER”; B$
FOR I = LEN(B$) TO 1 STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
M = M + C * 2 ^ P
P = P + 1
NEXT I
PRINT “DECIMAL VALUE IS “; M
END
Using declare
sub procedure
‘THIS PROGRAM CONVERTS BINARY
NUMBER TO DECIMAL
DECLARE SUB Z(B$)
CLS
INPUT “ENTER A BINARY NUMBER”; B$
CALL Z(B$)
END
SUB Z(B$)
FOR I = LEN(B$) TO 1 STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
M = M + C * 2 ^ P
P = P + 1
NEXT I
PRINT “DECIMAL VALUE IS “; M
END SUB
Using
declare function procedure
‘THIS PROGRAM
CONVERTS BINARY NUMBER TO DECIMAL
DECLARE FUNCTION Z
(B$)
CLS
INPUT “ENTER A
BINARY NUMBER”; B$
PRINT “DECIMAL VALUE
IS “; Z(B$)
END
FUNCTION Z (B$)
FOR I = LEN(B$) TO 1
STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
M = M + C * 2 ^ P
P = P + 1
NEXT I
Z = M
END FUNCTION
Program to
convert Octal to Decimal in Qbasic
‘THIS PROGRAM
CONVERTS OCTAL TO DECIMAL
CLS
INPUT “ENTER A OCTAL
VALUE”; B$
FOR I = LEN(B$) TO 1
STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
D = D + C * 8 ^ P
P = P + 1
NEXT I
PRINT “DECIMAL VALUE
IS”; D
END
Using
declare function procedure
‘THIS PROGRAM
CONVERTS OCTAL TO DECIMAL
DECLARE FUNCTION Z
(B$)
CLS
INPUT “ENTER A OCTAL
VALUE”; B$
PRINT “DECIMAL VALUE
IS”; Z(B$)
END
FUNCTION Z (B$)
FOR I = LEN(B$) TO 1
STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
D = D + C * 8 ^ P
P = P + 1
NEXT I
Z = D
END FUNCTION
Using
declare sub procedure
‘THIS PROGRAM
CONVERTS OCTAL TO DECIMAL
DECLARE SUB Z(B$)
CLS
INPUT “ENTER A OCTAL
VALUE”; B$
CALL Z(B$)
END
SUB Z(B$)
FOR I = LEN(B$) TO 1
STEP -1
A$ = MID$(B$, I, 1)
C = VAL(A$)
D = D + C * 8 ^ P
P = P + 1
NEXT I
PRINT “DECIMAL VALUE
IS”; D
END SUB
Program to
find the product of the digits of the given number in Qbasic
CLS
R = 1
INPUT “ENTER A NUMBER”;N
WHILE N<>0
A = N MOD 10
R = R * A
N = FIX ( N / 10 )
WEND
PRINT “PRODUCT OF DIGITS IS”;R
END
Using
declare sub procedure
DECLARE SUB C(N)
CLS
INPUT “ENTER A NUMBER”;N
CALL C(N)
END
SUB C(N)
R = 1
WHILE N<>0
A = N MOD 10
R = R * A
N = FIX ( N / 10 )
WEND
PRINT “PRODUCT OF DIGITS IS”;R
END SUB
Using
declare function procedure
DECLARE FUNCTION C(N)
CLS
INPUT “ENTER A NUMBER”;N
PRINT “PRODUCT OF DIGITS IS”;C(N)
END
FUNCTION C(N)
R = 1
WHILE N<>0
A = N MOD 10
R = R * A
N = FIX ( N / 10 )
WEND
C = R
END FUNCTION
Program to
find the sum of the digits of the given number in Qbasic
CLS
INPUT “ENTER A NUMBER”;N
WHILE N<>0
A = N MOD 10
R = R + A
N = FIX ( N / 10 )
WEND
PRINT “SUM OF DIGITS IS”;R
END
Using
declare function procedure
DECLARE FUNCTION C(N)
CLS
INPUT “ENTER A NUMBER”;N
PRINT “SUM OF DIGITS IS”;C(N)
END
FUNCTION C(N)
WHILE N<>0
A = N MOD 10
R = R + A
N = FIX ( N / 10 )
WEND
C = R
END FUNCTION
Using
declare sub procedure
DECLARE SUB C(N)
CLS
INPUT “ENTER A NUMBER”;N
CALL C(N)
END
SUB C(N)
WHILE N<>0
A = N MOD 10
R = R + A
N = FIX ( N / 10 )
WEND
PRINT “SUM OF DIGITS IS”;R
END SUB
Program to
print fibonacci series in Qbasic
Using
FOR…NEXT
CLS
A = 1
B = 2
PRINT A
PRINT B
FOR I = 1 TO 10
C = A + B
PRINT C
A = B
B = C
NEXT I
END
Using
WHILE…WEND
CLS
I = 1
A = 1
B = 2
PRINT A
PRINT B
WHILE I < = 10
C = A + B
PRINT C
A = B
B = C
I = I + 1
WEND
END
Using
declare sub procedure
Using
FOR…NEXT
DECLARE SUB FIB ()
CLS
CALL FIB
END
SUB FIB
A = 1
B = 2
PRINT A
PRINT B
FOR I = 1 TO 10
C = A + B
PRINT C
A = B
B = C
NEXT I
END SUB
Using
WHILE…WEND
DECLARE SUB FIB ()
CLS
CALL FIB
END
SUB FIB
I = 1
A = 1
B = 2
PRINT A
PRINT B
WHILE I < = 10
C = A + B
PRINT C
A = B
B = C
I = I + 1
WEND
END SUB
Program to
check whether a given number is prime or composite in qbasic
‘PROGRAM TO CHECK
WHETHER A GIVEN NUMBER IS PRIME OR COMPOSITE
CLS
INPUT “ENTER A
NUMBER”;N
FOR I = 2 TO N/2
IF N MOD I = 0 THEN
C = C+2
END IF
NEXT I
IF C>0 THEN
PRINT “IT IS COMPOSITE”
ELSE
? “IT IS PRIME”
END IF
END
Using
declare sub procedure
‘CHECK WHETHER A
GIVEN NUMBER IS PRIME OR COMPOSITE
DECLARE SUB A(N)
CLS
INPUT “ENTER A
NUMBER”;N
CALL A(N)
END
SUB A(N)
FOR I = 2 TO N/2
IF N MOD I = 0 THEN
C = C+2
END IF
NEXT I
IF C>0 THEN
PRINT “IT IS
COMPOSITE”
ELSE
? “IT IS PRIME”
END IF
END SUB
Using
declare function procedure
‘PROGRAM TO CHECK
WHETHER A GIVEN NUMBER IS PRIME OR COMPOSITE
DECLARE FUNCTION AB
(N)
CLS
INPUT “ENTER A
NUMBER”; N
IF AB(N) > 0 THEN
PRINT “IT IS
COMPOSITE”
ELSE
PRINT “IT IS PRIME”
END IF
END
FUNCTION AB (N)
FOR I = 2 TO N / 2
IF N MOD I = 0 THEN
C = C + 2
END IF
NEXT I
AB = C
END FUNCTION
QBASIC Customer management program
DECLARE SUB about ()
DECLARE SUB delrec ()
DECLARE SUB change ()
DECLARE SUB showrec ()
DECLARE SUB searchltd ()
DECLARE SUB addrecord ()
DECLARE SUB search ()
SCREEN 9
CLS
start:
PRINT "Admin Password:";
COLOR 0, 0
INPUT pass$
COLOR 7, 1
OPEN "pass.txt" FOR INPUT AS #10
INPUT #10, p$
IF pass$ = p$ THEN
'-----------if password match----------
CLS
start2:
CLS
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "Û MAIN MENU Û"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "1, add record"
PRINT "2, Show Records"
PRINT "3, Search Record"
PRINT "4, Search limited record"
PRINT "5, Delete Record"
PRINT "6, Change password"
PRINT "7, About"
PRINT "8, Exit"
INPUT "Choose Menu:", mn
SELECT CASE mn
CASE 1
CALL addrecord
GOTO start2
CASE 2
CALL showrec
GOTO start2
CASE 3
CALL search
GOTO start2
CASE 4
CALL searchltd
GOTO start2
CASE 5
CALL delrec
GOTO start2
CASE 6
CALL change
GOTO start2
CASE 7
CALL about
GOTO start2
CASE 8
COLOR 6, 8
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "DEMO BY: B. LIMBU"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "THANK YOU FOR USING THIS SOFTWARE"
PRINT "GOOD BYE"
INPUT "", by
END
CASE ELSE
PRINT "unknown menu"
PRINT "Û RETRY Û"
GOTO start2
END SELECT
'----------if password nor match-----------
ELSE
CLOSE #10
INPUT "password not macth. Try Again(y/n):", t$
IF t$ = "y" OR t$ = "Y" THEN
GOTO start
ELSE
COLOR 6, 6
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "DEMO BY: B. LIMBU"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "CONFIRM YOUR PASSWORD AND TRY AGAIN"
PRINT "GOOD BYE"
END
END IF
END IF
SUB about
COLOR 7, 9
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "DEMO BY: B. LIMBU"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "PRESS ANYKEY TO CONTINUE..."
COLOR 7, 1
INPUT "", IP
END SUB
SUB addrecord
add:
CLS
COLOR 10, 0
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "Û ADD RECORDS Û"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
lr = 0
OPEN "biran.txt" FOR INPUT AS #9
DO UNTIL EOF(9)
INPUT #9, rc, nm$, ad$, po$, sal
lr = lr + 1
LOOP
CLOSE #9
OPEN "biran.txt" FOR APPEND AS #5
PRINT "Current record No.:", lr
INPUT "Name:", n$
INPUT "Address:", a$
INPUT "Post:", p$
INPUT "Salary:", s
WRITE #5, lr + 1, n$, a$, p$, s
CLOSE #5
INPUT "Add more(y/n)"; am$
IF am$ = "y" OR am$ = "Y" THEN
GOTO add:
END IF
COLOR 7, 1
END SUB
SUB change
CLOSE #10
CLS
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "Û CHANGE PASSWORD Û"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
retry:
OPEN "pass.txt" FOR OUTPUT AS #8
COLOR 10, 0
PRINT "New Password:";
COLOR 0, 0
INPUT "", n1$
COLOR 10, 0
PRINT "Confirm Password:";
COLOR 0, 0
INPUT "", n2$
IF n1$ = n2$ THEN
WRITE #8, n1$
CLOSE #8
COLOR 15, 1
PRINT "PASSWORD CHANGED"
PRINT "Press Anykey to continue..."
INPUT "", pc
ELSE
COLOR 10, 0
CLOSE #8
PRINT "New Password Confirmation not match"
PRINT "Retry"
GOTO retry
END IF
END SUB
SUB delrec
del:
CLS
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "Û DELETE RECORDS Û"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
OPEN "biran.txt" FOR INPUT AS #9
DO UNTIL EOF(9)
INPUT #9, rc, nm$, ad$, po$, sal
PRINT rc, nm$, ad$, po$, sal
LOOP
CLOSE #9
'----show first--------
OPEN "biran.txt" FOR INPUT AS #3
OPEN "temp.txt" FOR OUTPUT AS #4
INPUT "choose record number to delete"; del
DO UNTIL EOF(3)
INPUT #3, rc, nm$, ad$, po$, sal
IF del <> rc THEN
WRITE #4, rc, nm$, ad$, po$, sal
END IF
LOOP
CLOSE #3, #4
KILL "biran.txt"
NAME "temp.txt" AS "biran.txt"
INPUT "Delete More(y/n)"; y$
IF y$ = "y" OR y$ = "Y" THEN
GOTO del
END IF
END SUB
SUB search
AGAIN:
CLS
PRINT TAB(25); "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT TAB(25); "SEARCH RECORDS"
PRINT TAB(25); "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
OPEN "biran.txt" FOR INPUT AS #2
INPUT "find what(RecNum,Name,address,post,salary):", fw$
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "RecNo. Name Address Post Salary"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
DO UNTIL EOF(2)
INPUT #2, rc, n$, ad$, po$, sal
IF rc = VAL(fw$) OR UCASE$(fw$) = UCASE$(n$) OR UCASE$(fw$) = UCASE$(ad$) OR UCASE$(fw$) = UCASE$(po$) OR sal = VAL(fw$) THEN
tr = tr + 1
PRINT rc, n$, ad$, po$, sal
END IF
LOOP
PRINT "total record:", tr
CLOSE #2
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
INPUT "Search more...(y/n):", sm$
IF sm$ = "y" OR sm$ = "Y" THEN
GOTO AGAIN
END IF
END SUB
SUB searchltd
search:
CLS
PRINT TAB(25); "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT TAB(25); "SEARCH LIMITED RECORDS"
PRINT TAB(25); "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
OPEN "biran.txt" FOR INPUT AS #2
INPUT "Search by Record Nomber(Start,End):", st, en
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "RecNo. Name Address Post Salary"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
DO UNTIL EOF(2)
INPUT #2, rc, n$, ad$, po$, sal
FOR i = st TO en
IF i = rc THEN
PRINT rc, n$, ad$, po$, sal
END IF
NEXT
LOOP
CLOSE #2
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
INPUT "Search more...(y/n):", sm$
IF sm$ = "y" OR sm$ = "Y" THEN
GOTO search
END IF
END SUB
SUB showrec
CLS
COLOR 6, 8
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "Û SHOW RECORDS Û"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
PRINT "RecNo. Name Address Post Salary"
PRINT "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"
OPEN "biran.txt" FOR INPUT AS #7
DO UNTIL EOF(7)
INPUT #7, rc, nm$, ad$, po$, sal
PRINT rc, nm$, ad$, po$, sal
LOOP
CLOSE #7
PRINT "Press anykey to back main menu..."
INPUT "", a
COLOR 7, 1
END SUB
Note: ASCII Code Combine: Alt + 987
Thank you
No comments:
Post a Comment
Thanks for your great comment!