Project Work Based On Qbasic: Telephone Directory
Project Work Based On Qbasic: Telephone Directory
Project Work Based On Qbasic: Telephone Directory
Based On QBASIC
Telephone Directory
Submitted To:
Ram K. Thapa
PREFACE
In today's world of science and technology computer has become
an integral part of everyone's life. Human life is more static existence with the
change in time and new discoveries in computer science. Advanced information,
processing technologies, global communication and internet have forced us to
remain wary of changes taking place in the world today.
They have a wide range in both the commercial and noncommercial fields it is used in engineering, industry, medicine, space, research,
education, banking, traveling, communication and industries. It can solve
problems using high technology including both sophisticated computer hardware
and software, high performance computing on heterogeneous way.
The last few decades of twentieth century have witnessed the
radical changes taking place, both in our lifestyle and computer technology
concomitantly. Rapid update in computer technology and development of new
versions of software has driven the world into new technical era. However, the
new versions of software have basically two distinct advantages. They are user
friendly and posses more facilities.
Qbasic is a high level computer program developed by
Microsoft Corporation. In 1985, Microsoft released their own versions of BASIC
called QBASIC with their MS-DOS.5.0 operating system in two files QBASIC.EXE
and QBASIC.HLP. Since then, PC also runs own copies. QBASIC environment
includes a full system syntax checking, multi-file and multi-window editing, full
debugging facilities, pull down menus syntax-checking editor and a power full
menu structures that can be driven through either by keyboard or a mouse. We
can edit, run, debug and return the program without switching programs in it.
My project is about Telephone Directory. It is provided with
various kinds of facilities such as adding, displaying, modifying, deleting and
searching the records. I have mentioned the aims and objectives of this project
work, its background, problems that have arise while making the program and
finally the output to show how the project looks like. I have also mentioned some
analyzing techniques like flowcharts and algorithm as well as the code source of
the program.
Thank You!!!
- Bishal Heuju
7
1
CONTENTS
Chapter Topic
Page
1.
2.
3.
4.
5.
6.
Algorithm
7.
Flowchart
18
8.
9.
10. Conclusion
71
7
1
7
1
7
1
ALGORITHM:
Entrance:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
SUB ADD1
WHILE NOT UCASE$(choice$) = "N"
OPEN "bishal.dat" FOR APPEND AS #1
CLS
SCREEN 9
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
LINE (20, 21)-(597, 21), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY "l32o2cdegab"
FOR A = 15 TO 602
LINE (15, 300)-(602, 300), 13, BF
Add:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
7
1
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
Credit:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
SUB CREDIT
CLS
DO
COLOR F
F=F+1
IF F > 14 THEN F = 1
I$ = INKEY$
LOCATE 7, 25: PRINT "Thanks For Choosing My Program"
LOCATE 8, 25: PRINT "Copyright (c) 2009"
LOCATE 10, 25: PRINT "By Bishal Heuju"
LOOP WHILE I$ = ""
LOCATE 13, 30
7
1
Step
Step
Step
Step
Step
Step
Step
92:
93:
94:
95:
96:
97:
98:
A$ = "Exiting...."
FOR B = 2 TO LEN(A$) + 1
FOR C = 1 TO 1000000: NEXT C
COLOR B: PRINT MID$(A$, B - 1, 1);
NEXT B
PLAY "o3 L8 E D+ E D+ E o2 B o3 D C L2 o2 A"
END SUB
Delete:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
7
1
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
143:
tem = 1
144:
PRINT
145:
ELSE
146:
WRITE #2, pcode, pname$, tel$, add$, email$
147:
END IF
148:
WEND
149:CASE 2
150:
LOCATE 11, 5: INPUT "Enter the name"; nname$
151:
WHILE NOT EOF(1)
152:
INPUT #1, pcode, pname$, tel$, add$, email$
153:
IF nname$ = pname$ THEN
154:
LOCATE 12, 5: PRINT "Record is deleted"
155:
LOCATE 13, 5: PRINT TIME$
156:
tem = 1
157:
PRINT
158:
ELSE
159:
WRITE #2, pcode, pname$, tel$, add$, email$
160:
END IF
161:
WEND
162:CASE 3
163:
LOCATE 11, 5: INPUT "Enter the telephone"; ntel$
164:
WHILE NOT EOF(1)
165:
INPUT #1, pcode, pname$, tel$, add$, email$
166:
IF ntel$ = tel$ THEN
167:
LOCATE 12, 5: PRINT "Record is deleted"
168:
LOCATE 13, 5: PRINT TIME$
169:
tem = 1
170:
PRINT
171:
ELSE
172:
WRITE #2, pcode, pname$, tel$, add$, email$
173:
END IF
174:
WEND
175:CASE 4
176:
LOCATE 11, 5: INPUT "Enter the address"; nadd$
177:
WHILE NOT EOF(1)
178:
INPUT #1, pcode, pname$, tel$, add$, email$
179:
IF nadd$ = add$ THEN
180:
LOCATE 12, 5: PRINT "Record is deleted"
181:
LOCATE 13, 5: PRINT TIME$
182:
tem = 1
183:
PRINT
184:
ELSE
185:
WRITE #2, pcode, pname$, tel$, add$, email$
186:
END IF
187:
WEND
188:CASE 5
189:
LOCATE 11, 5: INPUT "Enter the email"; nemail$
190:
WHILE NOT EOF(1)
191:
INPUT #1, pcode, pname$, tel$, add$, email$
192:
IF nemail$ = email$ THEN
193:
LOCATE 12, 5: PRINT "Record is deleted"
194:
LOCATE 13, 5: PRINT TIME$
195:
tem = 1
196:
PRINT
197:
ELSE
7
1
Step 198:
WRITE #2, pcode, pname$, tel$, add$, email$
Step 199:
END IF
Step 200:
WEND
Step 201:CASE ELSE
Step 202:
LOCATE 19, 5: PRINT "Invalid input"
Step 203:
new$ = INPUT$(1)
Step 204:
GOTO top55
Step 205:END SELECT
Step 206:IF tem = 0 THEN
Step 207:BEEP
Step 208:LOCATE 20, 5: PRINT "Record not found"
Step 209:END IF
Step 210:CLOSE #1
Step 211:CLOSE #2
Step 212:KILL "bishal.dat"
Step 213:NAME "temp.dat" AS "bishal.dat"
Step 214:LOCATE 24, 5: INPUT "Do you want to delete more records (y/n)";
del$
Step 215:y/n)"; del$
Step 216:IF UCASE$(del$) = "Y" THEN GOTO top
Step 217:CALL DISPLAY
Step 218:END SUB
Dispaly:
Step 219:SUB DISPLAY
Step 220:CALL LOAD
Step 221:OPEN "bishal.dat" FOR INPUT AS #1
Step 222:first:
Step 223:ct = 4
Step 224:CLS
Step 225:LOCATE 2, 1: PRINT "Code"
Step 226:LOCATE 2, 6: PRINT "Full Name"
Step 227:LOCATE 2, 25: PRINT "Telephone"
Step 228:LOCATE 2, 37: PRINT "Address"
Step 229:LOCATE 2, 50: PRINT "E-mail"
Step 230:PRINT STRING$(80, "-")
Step 231:WHILE NOT EOF(1)
Step 232:
INPUT #1, pcode, pname$, tel$, add$, email$
Step 233:
LOCATE ct, 1: PRINT pcode
Step 234:
LOCATE ct, 6: PRINT pname$
Step 235:
LOCATE ct, 25: PRINT tel$
Step 236:
LOCATE ct, 37: PRINT add$
Step 237:
LOCATE ct, 50: PRINT email$
Step 238:
ct = ct + 1
Step 239:
IF ct >= 23 THEN LOCATE 24, 15: PRINT "Press any key to view
next records": C$ = INPUT$(1): GOTO first
Step 240:WEND
Step 241:CLOSE #1
Step 242:LOCATE 25, 15: PRINT "Press any key to goto main menu"
Step 243:main$ = INPUT$(1)
Step 244:CALL MENU
Step 245:END SUB
7
1
Load:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
246:SUB LOAD
247:CLS
248:SCREEN 9
249:COLOR 2, 8: LOCATE 12, 24: PRINT "SEARCHING...."
250:COLOR 10: LINE (200, 200)-(340, 220), , B
251:LOCATE 14, 24: PRINT "PLEASE WAIT"
252:A = 201
253:FOR B = 1 TO 70
254:COLOR 2: LINE (A, 201)-(A, 218)
255:A = A + 2
256:FOR C = 1 TO 100000
257:NEXT C
258:NEXT B
259:END SUB
Menu:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
260:SUB MENU
261:CLS
262:SCREEN 9
263:COLOR 2, 8
264:FOR A = 15 TO 602
265:LINE (15, 16)-(602, 16), 13, BF
266:LINE (20, 21)-(597, 21), 13, BF
267:NEXT
268:FOR B = 1 TO 1000000
269:NEXT
270:PLAY "l32o2cdefgab"
271:FOR A = 15 TO 602
272:LINE (15, 300)-(602, 300), 13, BF
273:LINE (20, 295)-(597, 295), 13, BF
274:NEXT
275:FOR B = 1 TO 1000000
276:NEXT
277:PLAY ">cdefgab"
278:LINE (14, 16)-(14, 300), 13, BF
279:LINE (19, 21)-(19, 295), 13, BF
280:PLAY "l32o2>cdefgab"
281:LINE (602, 16)-(602, 300), 13, BF
282:LINE (597, 21)-(597, 295), 13, BF
283:PLAY ">cdefgab"
284:LOCATE 4, 5: PRINT "Date = "; DATE$
285:LOCATE 4, 55: PRINT "Time = "; TIME$
286:LOCATE 6, 25: PRINT "Telephone Directory"
287:LOCATE 7, 25: PRINT "===================="
288:LOCATE 9, 25: PRINT "1. Add Records"
289:LOCATE 10, 25: PRINT "2. Display All Records"
290:LOCATE 11, 25: PRINT "3. Modify Record"
7
1
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Modify:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
312:SUB MODIFY
313:OPEN "i", #1, "bishal.dat"
314:OPEN "o", #2, "temp.dat"
315:top2:
316:CLS
317:SCREEN 9
318:COLOR 2, 8
319:FOR A = 15 TO 602
320:LINE (15, 16)-(602, 16), 13, BF
321:LINE (20, 21)-(597, 21), 13, BF
322:NEXT
323:FOR B = 1 TO 1000000
324:NEXT
325:PLAY "l32o2cdefgab"
326:FOR A = 15 TO 602
327:LINE (15, 300)-(602, 300), 13, BF
328:LINE (20, 295)-(597, 295), 13, BF
329:NEXT
330:FOR B = 1 TO 1000000
331:NEXT
332:PLAY ">cdefgab"
333:LINE (14, 16)-(14, 300), 13, BF
334:LINE (19, 21)-(19, 295), 13, BF
335:PLAY "l32o2>cdefgab"
336:LINE (602, 16)-(602, 300), 13, BF
337:LINE (597, 21)-(597, 295), 13, BF
338:PLAY ">cdefgab"
7
1
Step 341:tem = 0
Step 342:LOCATE 3, 5: INPUT "Enter the name"; nname$
Step 343:WHILE NOT EOF(1)
Step 344:INPUT #1, pcode, pname$, tel$, add$, email$
Step 345:IF (nname$ = pname$) THEN
Step 346:LOCATE 6, 5: PRINT "Press C to change information"
Step 347:LOCATE 8, 5: PRINT "Code number = "; pcode
Step 348:d$ = INPUT$(1)
Step 349:IF UCASE$(d$) = "C" THEN
Step 350:LOCATE 8, 35: INPUT "Enter new code number"; pcode
Step 351:END IF
Step 352:LOCATE 9, 5: PRINT "Name
= "; pname$
Step 353:d$ = INPUT$(1)
Step 354:IF UCASE$(d$) = "C" THEN
Step 355:LOCATE 9, 35: INPUT "Enter new name"; pname$
Step 356:END IF
Step 357:LOCATE 10, 5: PRINT "Telephone = "; tel$
Step 358:d$ = INPUT$(1)
Step 359:IF UCASE$(d$) = "C" THEN
Step 360:LOCATE 10, 35: INPUT "Enter new telephone"; tel$
Step 361:END IF
Step 362:LOCATE 11, 5: PRINT "Address
= "; add$
Step 363:d$ = INPUT$(1)
Step 364:IF UCASE$(d$) = "C" THEN
Step 365:LOCATE 11, 35: INPUT "Enter new address"; add$
Step 366:END IF
Step 367:LOCATE 12, 5: PRINT "E-mail
= "; email$
Step 368:d$ = INPUT$(1)
Step 369:IF UCASE$(d$) = "C" THEN
Step 370:LOCATE 12, 35: INPUT "Enter new e-mail"; email$
Step 371:END IF
Step 372:WRITE #2, pcode, pname$, tel$, add$, email$
Step 373:LOCATE 14, 5: PRINT "Record modified successfully"
Step 374:LOCATE 15, 5: PRINT TIME$
Step 375:LOCATE 16, 20: PRINT "New code number = "; pcode
Step 376:LOCATE 17, 20: PRINT "New name
= "; pname$
Step 377:LOCATE 18, 20: PRINT "New telephone = "; tel$
Step 378:LOCATE 19, 20: PRINT "New address
= "; add$
Step 379:LOCATE 20, 20: PRINT "New e-mail
= "; email$
Step 380:tem = 1
Step 381:ELSE
Step 382:WRITE #2, pcode, pname$, tel$, add$, email$
Step 383:END IF
Step 384:WEND
Step 385:CLOSE #1
Step 386:CLOSE #2
Step 387:KILL "bishal.dat"
Step 388:NAME "temp.dat" AS "bishal.dat"
Step 389:IF tem = 0 THEN
Step 390:BEEP
Step 391:LOCATE 20, 5: PRINT "Record not found"
Step 392:END IF
Step 393:LOCATE 23, 15: INPUT "Do you want to modify more records(y/n)";
modif$
7
1
Search:
Step 397:SUB SEARCH
Step 398:top1:
Step 399:CLS
Step 400:SCREEN 9
Step 401:COLOR 2, 8
Step 402:FOR A = 15 TO 602
Step 403:LINE (15, 16)-(602, 16), 13, BF
Step 404:LINE (20, 21)-(597, 21), 13, BF
Step 405:NEXT
Step 406:FOR B = 1 TO 1000000
Step 407:NEXT
Step 408:PLAY "l32o2cdegab"
Step 409:FOR A = 15 TO 602
Step 410:LINE (15, 300)-(602, 300), 13, BF
Step 411:LINE (20, 295)-(597, 295), 13, BF
Step 412:NEXT
Step 413:FOR B = 1 TO 1000000
Step 414:NEXT
Step 415:PLAY ">cdefgab"
Step 416:LINE (14, 16)-(14, 300), 13, BF
Step 417:LINE (19, 21)-(19, 295), 13, BF
Step 418:PLAY "l32o2>cdefgab"
Step 419:LINE (602, 16)-(602, 300), 13, BF
Step 420:LINE (597, 21)-(597, 295), 13, BF
Step 421:PLAY ">cdefgab"
Step 422:tem = 0
Step 423:OPEN "i", #1, "bishal.dat"
LOCATE 3, 5: PRINT "What do you want to search the information by?"
Step 424:LOCATE 4, 5: PRINT "1. Code number"
Step 425:LOCATE 5, 5: PRINT "2. Name"
Step 426:LOCATE 6, 5: PRINT "3. Telephone"
Step 427:LOCATE 7, 5: PRINT "4. Address"
Step 428:LOCATE 8, 5: PRINT "5. E-mail"
Step 429:LOCATE 9, 5: INPUT "Enter your choice (1-5)"; choi
Step 430:SELECT CASE choi
Step 431:CASE 1
Step 432:
LOCATE 11, 5: INPUT "Enter the code number"; ncode
Step 433:
ct = 4
Step 434:
CALL LOAD
Step 435:
CLS
Step 436:
WHILE NOT EOF(1)
Step 437:
INPUT #1, pcode, pname$, tel$, add$, email$
Step 438:
IF ncode = pcode THEN
Step 439:
CLS
Step 440:
LOCATE 2, 1: PRINT "Code"
Step 441:
LOCATE 2, 6: PRINT "Full Name"
Step 442:
LOCATE 2, 25: PRINT "Telephone"
Step 443:
LOCATE 2, 37: PRINT "Address"
7
1
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
444:
LOCATE 2, 50: PRINT "E-mail"
445:
PRINT STRING$(80, "-")
446:
LOCATE ct, 1: PRINT pcode
447:
LOCATE ct, 6: PRINT pname$
448:
LOCATE ct, 25: PRINT tel$
449:
LOCATE ct, 37: PRINT add$
450:
LOCATE ct, 50: PRINT email$
451:
ct = ct + 1
452:
tem = 1
453:
END IF
454:
WEND
455:CASE 2
456:
ct = 4
457:
LOCATE 3, 5: INPUT "Enter the name"; nname$
458:
CALL LOAD
459:
CLS
460:
WHILE NOT EOF(1)
461:
INPUT #1, pcode, pname$, tel$, add$, email$
462:
IF UCASE$(nname$) = UCASE$(pname$) THEN
463:
CLS
464:
LOCATE 2, 1: PRINT "Code"
465:
LOCATE 2, 6: PRINT "Full Name"
466:
LOCATE 2, 25: PRINT "Telephone"
467:
LOCATE 2, 37: PRINT "Address"
468:
LOCATE 2, 50: PRINT "E-mail"
469:
PRINT STRING$(80, "-")
470:
LOCATE ct, 1: PRINT pcode
471:
LOCATE ct, 6: PRINT pname$
472:
LOCATE ct, 25: PRINT tel$
473:
LOCATE ct, 37: PRINT add$
474:
LOCATE ct, 50: PRINT email$
475:
ct = ct + 1
476:
tem = 1
477:
END IF
478:
WEND
479:CASE 3
480:
ct = 4
481:
LOCATE 11, 5: INPUT "Enter the telephone"; ntel$
482:
CALL LOAD
483:
CLS
484:
WHILE NOT EOF(1)
485:
INPUT #1, pcode, pname$, tel$, add$, email$
486:
IF ntel$ = tel$ THEN
487:
CLS
488:
LOCATE 2, 1: PRINT "Code"
489:
LOCATE 2, 6: PRINT "Full Name"
490:
LOCATE 2, 25: PRINT "Telephone"
491:
LOCATE 2, 37: PRINT "Address"
492:
LOCATE 2, 50: PRINT "E-mail"
493:
PRINT STRING$(80, "-")
494:
LOCATE ct, 1: PRINT pcode
495:
LOCATE ct, 6: PRINT pname$
496:
LOCATE ct, 25: PRINT tel$
497:
LOCATE ct, 37: PRINT add$
498:
LOCATE ct, 50: PRINT email$
7
1
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
499:
ct = ct + 1
500:
tem = 1
501:
END IF
502:
WEND
503:CASE 4
504:
ct = 4
505:
LOCATE 11, 5: INPUT "Enter the address"; nadd$
506:
CALL LOAD
507:
CLS
508:
WHILE NOT EOF(1)
509:
INPUT #1, pcode, pname$, tel$, add$, email$
510:
IF UCASE$(nadd$) = UCASE$(add$) THEN
511:
LOCATE 2, 1: PRINT "Code"
512:
LOCATE 2, 6: PRINT "Full Name"
513:
LOCATE 2, 25: PRINT "Telephone"
514:
LOCATE 2, 37: PRINT "Address"
515:
LOCATE 2, 50: PRINT "E-mail"
516:
PRINT STRING$(80, "-")
517:
LOCATE ct, 1: PRINT pcode
518:
LOCATE ct, 6: PRINT pname$
519:
LOCATE ct, 25: PRINT tel$
520:
LOCATE ct, 37: PRINT add$
521:
LOCATE ct, 50: PRINT email$
522:
ct = ct + 1
523:
tem = 1
524:
END IF
525:
WEND
526:CASE 5
527:
ct = 4
528:
LOCATE 11, 5: INPUT "Enter the email"; nemail$
529:
CALL LOAD
530:
CLS
531:
WHILE NOT EOF(1)
532:
INPUT #1, pcode, pname$, tel$, add$, email$
533:
IF UCASE$(nemail$) = UCASE$(email$) THEN
534:
CLS
535:
LOCATE 2, 1: PRINT "Code"
536:
LOCATE 2, 6: PRINT "Full Name"
537:
LOCATE 2, 25: PRINT "Telephone"
538:
LOCATE 2, 37: PRINT "Address"
539:
LOCATE 2, 50: PRINT "E-mail"
540:
PRINT STRING$(80, "-")
541:
LOCATE ct, 1: PRINT pcode
542:
LOCATE ct, 6: PRINT pname$
543:
LOCATE ct, 25: PRINT tel$
544:
LOCATE ct, 37: PRINT add$
545:
LOCATE ct, 50: PRINT email$
546:
ct = ct + 1
547:
tem = 1
548:
END IF
549:
WEND
550:END SELECT
551:IF tem = 0 THEN
552:BEEP
553:LOCATE 10, 15: PRINT "Record not found"
7
1
Step 554:END IF
Step 555:CLOSE #1
Step 556:LOCATE 25, 10: INPUT "Do you want to search more records(y/n)";
sea$
Step 557:IF UCASE$(sea$) = "Y" THEN GOTO top1 ELSE CALL MENU
Step 558:END SUB
PROGRAM FLOWCHART:
Main:
START
continue$=INPUT$(
1)
PRINT LOADING
C
1
7
1
C
1
FOR A= 32 TO 35
PRINT .
NEXT A
A=201
FOR B= 1 TO 70
FOR C= 1 TO 100000
NEXT C
NEXT B
CALL MENU
STOP
7
1
Sub add:
START
T
O
C
2
Is UCASE$
(CHOICE$) =
N
YES
W
E
NO
Is
npcode=p
N
code
O
OPEN bishal.dat FOR APPEND AS #1
YES
PRINT Code already exists
PRINT Inserting the information
PRINT
Record
not added
INPUT
Code
number;
npcode
OPEN bishal.dat FOR APPEND AS #3
CLOSE #3
L
A
pcode = npcode
YES
Is EOF
reache
d?
INPUT Full name;pname$
NO
E
F
E
F
C
INPUT Address;add$
2
INPUT E-mail;email$
C
3
L
A
CLOSE #1
T
O
CALL MENU
STOP
7
1
Sub credit:
CSTART
4
PRINT Copyright
(c)
COLOR
F 2009
= F +Heuju
1
PRINT By FBishal
M
E
NO
Is F >
Is I$ =
14
YES
F=1
NO
YES
I$ = INKEY$
A$ = Exiting.
START
T
OPEN bishal.dat FOR INPUT AS #1
Tem=0
to
p
PRINT What do you want to delete records
by?
PRINT 1. Code No.
PRINT 2. Name
PRINT 3. Telephone
PRINT 4. Address
Sub delete:
PRINT 5. E-mail
C
5
YES
Is
ch
=
NO 1
Is
ch
=
NO 2
YES
Is
ch
=
3
YES
Is
ch
=
4
YES
Is
ch
=
NO 5
YES
NO
NO
YES
H
1
H
2
H
3
H
4
H
5
to
p
7
1
C
6
CLOSE #1
CLOSE #2
KILL Bishal.dat
NAME temp.dat AS
Bishal.dat
INPUT Do you want to delete more records
(y/n);del$
Is UCASE$
(del$)
=Y
YES
T
NO
CALL DISPLAY
STOP
7
1
H
1
INPUT Enter the code
no.;pcode
INPUT #1, pcode, pname$, tel$, add$,
email$
Is
ncode
=
pcode
YES
PRINT Record is
deleted
PRINT TIME$
NO
WRITE #2, pcode, pname$, tel$, add$,
email$
tem =1
H
2
INPUT Enter the name;nname$
Is EOF
NO
reach
ed?
INPUT #1, pcode, pname$, tel$, add$,
email$
YES
B
Is
nname$
=
pname$
YES
PRINT Record is
deleted
PRINT TIME$
NO
WRITE #2, pcode, pname$, tel$, add$,
email$
NO
tem =1
Is EOF
reach
ed?
YES
B
7
1
H
3
INPUT Enter the telephone;
ntel$
INPUT #1, pcode, pname$, tel$, add$,
email$
Is
ntel$
= tel$
YES
PRINT Record is
deleted
PRINT TIME$
NO
tem =1
Is EOF
reach
ed?
YES
NO B
7
1
H
4
INPUT Enter the address;
nadd$
INPUT #1, pcode, pname$, tel$, add$,
email$
Is
nadd$
=
add$
YES
PRINT Record is
deleted
PRINT TIME$
NO
WRITE #2, pcode, pname$, tel$, add$,
email$
NO
tem =1
Is EOF
reach
ed?
YES
B
7
1
H
5
INPUT Enter the email; nemail$
Is
nemai
l$=
email
$
YES
PRINT Record is
deleted
PRINT TIME$
NO
WRITE #2, pcode, pname$, tel$, add$,
email$
NO
tem =1
Is EOF
reach
ed?
YES
B
7
1
START
CALL LOAD
Sub display:
E
O
PRINT STRING$(80,
-)
INPUT #1, pcode, pname$, tel$, add$,
email$
LOCATE ct, 1: PRINT pcode
7
1
C
C
7
ct = ct + 1
NO
Is
ct>
=23
YES
E
O
NO
Is EOF
reach
ed?
YES
C
7
1
C
8
CLOSE #1
CALL MENU
7
1
STOP
Sub load:
START
PRINT SEARCHING.
A=201
L
1
FOR B= 1 TO 70
C
C9
9
LINE (A, 201)-(A, 218)
A=A+2
FOR C= 1 TO 100000
NEXT C
L
1
NEXT B
STOP
7
1
Sub menu:
C1
0
START
PRINT 2. Display All Records
LOCATE 4, 5: PRINT "Date = "; DATE$
PRINT 3. Modify Record
LOCATE 4, 55: PRINT "Time = "; TIME$
PRINT 4. Delete Record
LOCATE 6, 25: PRINT "Telephone
Directory"
PRINT 5. Search Record
LOCATE 7, 25: PRINT
"===================="
PRINT 6. Exit
PRINT "1. Add Records"
PRINT Enter the choice (1-6)
C1
0
ch$ = INPUT$(1)
IS
ch$
=
1
YES
NO
IS
ch$
=
2
NO
YES
IS
ch$
=
3
YES
C1
CALL ADD1
NO
CALL DISPALY
CALL MODIFY
7
1
C11
NO
IS ch$
= 4
YES
CALL DELETE
NO
IS ch$
= 5
YES
CALL SEARCH
NO
CALL CREDIT
STOP
7
1
Sub modify:
START
T2
OPEN i, #1, bishal.dat
C1
2
OPEN O, #1,
temp.dat
TE
IS
temNO
=0
LO
nname
$=
pname
INPUT
$ Enter the name; nname$
YES
PRINT PressINPUT
C to change
information
#1, pcode,
pname$, tel$, add$,
email$
PRINT Code number =; pcode
C1
2
d$ = INPUT$(1)
IS
UCASE
$ (d$)
= C
NO
YES
d$ = INPUT$(1)
IS
UCASE
$ (d$)
= C
NO
C1
YES
C1
3
PRINT Telephone =; tel$
umber; pcode
elephone
=; pcode
d$ = INPUT$(1)
IS
UCASE
$ (d$)
= C
YES
NO
PRINT Address =; add$
umber; pcode
elephone
=; pcode
d$ = INPUT$(1)
IS
UCASE
$ (d$)
= C
NO
YES
IS UCASE$ (d$) =
C
YES
NO
C1
C1
4
WRITE #2, pcode, pname$, tel$, add$,
email$
PRINT Record modified
succesfully
PRINT TIME$
tem = 1
LO
WRITE #2, pcode, pname$, tel$, add$,
email$
IS EOF reached?
NO
YES
C1
TE
7
1
C1
5
CLOSE #1
CLOSE #2
KILL bishal.dat
NAME temp.dat AS
bishal.dat
IS tem=0
YES
BEEP
NO
T2
YES
IS UCASE$ (modif$)
= Y
NO
CALL MENU
7
1
STOP
START
P1
tem = 0
Sub search:
PRINT 2. Name
PRINT 3. Telephone
PRINT 4. Address
PRINT 5. E-mail
IS
choi
1-5?
NO
C1
6
YES
7
1
N1
N2
N3
N4
N5
C1
6
IS
tem
=
0?
N
O
YES
BEEP
CLOSE #1
TE
IS
tem
=
N 0?
YES
P1
O
CALL MENU
7
1
STOP
N1
ct = 4
CALL LOAD
UP
1
IS
ncode
=
pcode
YES
NO
D1
LOCATE 2, 1: PRINT
"Code"
LOCATE 2, 6: PRINT "Full
Name"
LOCATE 2, 25: PRINT
"Telephone"
LOCATE 2, 37: PRINT
"Address"
LOCATE 2, 50: PRINT "Email"
PRINT STRING$(80,-)
7
1
C1
C1
7
LOCATE ct, 1: PRINT
pcode
LOCATE ct, 6: PRINT pname$
N2
LOCATE ct, 25: PRINT tel$
INPUT Enter the name; nname$
LOCATE ct, 37: PRINT
add$
ct = 4
LOCATE ct, 50: PRINT
email$
CALL LOAD
UP
2
ct = ct + 1
INPUT #1, pcode, pname$, tel$, add$,
email$
tem = 1
D1
IS UCASE$
(nname$) =
NO
IS EOF
UCASE$
reache
(pname$)
d?
YES
NO
D2
UP
1
LOCATE YES
2, 1: PRINT
"Code"
TE
LOCATE 2, 6: PRINT "Full
Name"
LOCATE 2, 25: PRINT
"Telephone"
LOCATE 2, 37: PRINT
"Address"
LOCATE 2, 50: PRINT "Email"
PRINT STRING$(80,-)
7
1
C1
C1
8
LOCATE ct, 1: PRINT
pcode
LOCATE ct, 6: PRINT pname$
tem = 1
D2
IS EOF
reache
d?
YES
TE
NO
UP
2
7
1
N3
ct = 4
CALL LOAD
UP
3
IS
ntel$
= tel$
NO
D3
YES
LOCATE 2, 1: PRINT
"Code"
LOCATE 2, 6: PRINT "Full
Name"
LOCATE 2, 25: PRINT
"Telephone"
LOCATE 2, 37: PRINT
"Address"
LOCATE 2, 50: PRINT "Email"
PRINT STRING$(80,-)
7
1
C1
C1
9
LOCATE ct, 1: PRINT
pcode
LOCATE ct, 6: PRINT pname$
tem = 1
D3
IS EOF
reache
d?
YES
TE
NO
UP
3
7
1
N4
ct = 4
CALL LOAD
UP
4
IS UCASE$
(nadd$) =
UCASE$
(add$)
YES
NO
D4
LOCATE 2, 1: PRINT
"Code"
LOCATE 2, 6: PRINT "Full
Name"
LOCATE 2, 25: PRINT
"Telephone"
LOCATE 2, 37: PRINT
"Address"
LOCATE 2, 50: PRINT "Email"
PRINT STRING$(80,-)
7
1
C2
C2
0
LOCATE ct, 1: PRINT
pcode
LOCATE ct, 6: PRINT pname$
tem = 1
D4
IS EOF
reache
d?
YES
TE
NO
UP
4
7
1
N5
ct = 4
CALL LOAD
UP
5
IS UCASE$
(nemail$) =
UCASE$
(email$)
YES
NO
D5
LOCATE 2, 1: PRINT
"Code"
LOCATE 2, 6: PRINT "Full
Name"
LOCATE 2, 25: PRINT
"Telephone"
LOCATE 2, 37: PRINT
"Address"
LOCATE 2, 50: PRINT "Email"
PRINT STRING$(80,-)
7
1
C2
C2
1
LOCATE ct, 1: PRINT
pcode
LOCATE ct, 6: PRINT pname$
tem = 1
D5
IS EOF
reache
d?
YES
TE
NO
UP
5
7
1
PROGRAM CODING
Entrance:
DECLARE SUB DISPLAY ()
DECLARE SUB MENU ()
DECLARE SUB SEARCH ()
DECLARE SUB DELETE ()
DECLARE SUB MODIFY ()
DECLARE SUB DISPALY ()
DECLARE SUB ADD1 ()
DECLARE SUB LOAD ()
DECLARE SUB CREDIT ()
CLS
SCREEN 9
PRINT "Press any key to continue"
7
1
continue$ = INPUT$(1)
COLOR 2, 8: LOCATE 12, 24: PRINT "LOADING"
FOR A = 32 TO 35
LOCATE 12, A: PRINT "."
NEXT A
COLOR 10: LINE (200, 200)-(340, 220), , B
LOCATE 14, 24: PRINT "PLEASE WAIT"
A = 201
FOR B = 1 TO 70
COLOR 2: LINE (A, 201)-(A, 218)
A=A+2
FOR C = 1 TO 100000
NEXT C
NEXT B
CALL MENU
END
Add:
SUB ADD1
WHILE NOT UCASE$(choice$) = "N"
OPEN "bishal.dat" FOR APPEND AS #1
CLS
SCREEN 9
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
LINE (20, 21)-(597, 21), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY "l32o2cdegab"
FOR A = 15 TO 602
LINE (15, 300)-(602, 300), 13, BF
LINE (20, 295)-(597, 295), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY ">cdefgab"
LINE (14, 16)-(14, 300), 13, BF
LINE (19, 21)-(19, 295), 13, BF
PLAY "l32o2>cdefgab"
LINE (602, 16)-(602, 300), 13, BF
LINE (597, 21)-(597, 295), 13, BF
PLAY ">cdefgab"
LOCATE 4, 20: PRINT "Inserting the information"
LOCATE 6, 5: INPUT "Code number"; npcode
OPEN "bishal.dat" FOR INPUT AS #3
WHILE NOT EOF(3)
INPUT #3, pcode
IF npcode = pcode THEN
BEEP
LOCATE 7, 7: PRINT "Code already exists"
LOCATE 8, 7: PRINT "Record not added"
7
1
CLOSE #3
GOTO last99
END IF
WEND
CLOSE #3
pcode = npcode
LOCATE 7, 5: INPUT "Full name "; pname$
LOCATE 8, 5: INPUT "Telephone "; tel$
LOCATE 9, 5: INPUT "Address "; add$
LOCATE 10, 5: INPUT "E-mail "; email$
WRITE #1, pcode, pname$, tel$, add$, email$
last99:
CLOSE #1
LOCATE 15, 5: INPUT "Do you want to add more record(y/n)"; choice$
WEND
CALL MENU
END SUB
Credit:
SUB CREDIT
CLS
DO
COLOR F
F=F+1
IF F > 14 THEN F = 1
I$ = INKEY$
LOCATE 7, 25: PRINT "Thanks For Choosing My Program"
LOCATE 8, 25: PRINT "Copyright (c) 2009"
LOCATE 10, 25: PRINT "By Bishal Heuju"
LOOP WHILE I$ = ""
LOCATE 13, 30
A$ = "Exiting...."
FOR B = 2 TO LEN(A$) + 1
FOR C = 1 TO 1000000: NEXT C
COLOR B: PRINT MID$(A$, B - 1, 1);
NEXT B
PLAY "o3 L8 E D+ E D+ E o2 B o3 D C L2 o2 A"
END SUB
Delete:
SUB DELETE
top:
CLS
SCREEN 9
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
LINE (20, 21)-(597, 21), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY "l32o2cdegab"
FOR A = 15 TO 602
LINE (15, 300)-(602, 300), 13, BF
7
1
Display:
SUB DISPLAY
7
1
CALL LOAD
OPEN "bishal.dat" FOR INPUT AS #1
first:
ct = 4
CLS
LOCATE 2, 1: PRINT "Code"
LOCATE 2, 6: PRINT "Full Name"
LOCATE 2, 25: PRINT "Telephone"
LOCATE 2, 37: PRINT "Address"
LOCATE 2, 50: PRINT "E-mail"
PRINT STRING$(80, "-")
WHILE NOT EOF(1)
INPUT #1, pcode, pname$, tel$, add$, email$
LOCATE ct, 1: PRINT pcode
LOCATE ct, 6: PRINT pname$
LOCATE ct, 25: PRINT tel$
LOCATE ct, 37: PRINT add$
LOCATE ct, 50: PRINT email$
ct = ct + 1
IF ct >= 23 THEN
LOCATE 24, 15: PRINT "Press any key to view next records":
C$ = INPUT$(1)
GOTO first
END IF
WEND
CLOSE #1
LOCATE 25, 15: PRINT "Press any key to go to main menu"
main$ = INPUT$(1)
CALL MENU
END SUB
Load:
SUB LOAD
CLS
SCREEN 9
COLOR 2, 8: LOCATE 12, 24: PRINT "SEARCHING...."
COLOR 10: LINE (200, 200)-(340, 220), , B
LOCATE 14, 24: PRINT "PLEASE WAIT"
A = 201
FOR B = 1 TO 70
COLOR 2: LINE (A, 201)-(A, 218)
A=A+2
FOR C = 1 TO 100000
NEXT C
NEXT B
END SUB
Menu:
SUB MENU
CLS
SCREEN 9
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
7
1
Modify:
SUB MODIFY
top2:
OPEN "i", #1, "bishal.dat"
OPEN "o", #2, "temp.dat"
CLS
SCREEN 9
7
1
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
LINE (20, 21)-(597, 21), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY "l32o2cdefgab"
FOR A = 15 TO 602
LINE (15, 300)-(602, 300), 13, BF
LINE (20, 295)-(597, 295), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY ">cdefgab"
LINE (14, 16)-(14, 300), 13, BF
LINE (19, 21)-(19, 295), 13, BF
PLAY "l32o2>cdefgab"
LINE (602, 16)-(602, 300), 13, BF
LINE (597, 21)-(597, 295), 13, BF
PLAY ">cdefgab"
tem = 0
LOCATE 3, 5: INPUT "Enter the name"; nname$
WHILE NOT EOF(1)
INPUT #1, pcode, pname$, tel$, add$, email$
IF (nname$ = pname$) THEN
LOCATE 6, 5: PRINT "Press C to change information"
LOCATE 8, 5: PRINT "Code number = "; pcode
d$ = INPUT$(1)
IF UCASE$(d$) = "C" THEN
LOCATE 8, 35: INPUT "Enter new code number"; pcode
END IF
LOCATE 9, 5: PRINT "Name
= "; pname$
d$ = INPUT$(1)
IF UCASE$(d$) = "C" THEN
LOCATE 9, 35: INPUT "Enter new name"; pname$
END IF
LOCATE 10, 5: PRINT "Telephone = "; tel$
d$ = INPUT$(1)
IF UCASE$(d$) = "C" THEN
LOCATE 10, 35: INPUT "Enter new telephone"; tel$
END IF
LOCATE 11, 5: PRINT "Address
= "; add$
d$ = INPUT$(1)
IF UCASE$(d$) = "C" THEN
LOCATE 11, 35: INPUT "Enter new address"; add$
END IF
LOCATE 12, 5: PRINT "E-mail
= "; email$
d$ = INPUT$(1)
IF UCASE$(d$) = "C" THEN
LOCATE 12, 35: INPUT "Enter new e-mail"; email$
END IF
WRITE #2, pcode, pname$, tel$, add$, email$
7
1
Search:
SUB SEARCH
top1:
CLS
SCREEN 9
COLOR 2, 8
FOR A = 15 TO 602
LINE (15, 16)-(602, 16), 13, BF
LINE (20, 21)-(597, 21), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY "l32o2cdegab"
FOR A = 15 TO 602
LINE (15, 300)-(602, 300), 13, BF
LINE (20, 295)-(597, 295), 13, BF
NEXT
FOR B = 1 TO 1000000
NEXT
PLAY ">cdefgab"
LINE (14, 16)-(14, 300), 13, BF
LINE (19, 21)-(19, 295), 13, BF
PLAY "l32o2>cdefgab"
LINE (602, 16)-(602, 300), 13, BF
LINE (597, 21)-(597, 295), 13, BF
PLAY ">cdefgab"
tem = 0
OPEN "i", #1, "bishal.dat"
7
1
WEND
CASE 3
ct = 4
LOCATE 11, 5: INPUT "Enter the telephone"; ntel$
CALL LOAD
CLS
WHILE NOT EOF(1)
INPUT #1, pcode, pname$, tel$, add$, email$
IF ntel$ = tel$ THEN
CLS
LOCATE 2, 1: PRINT "Code"
LOCATE 2, 6: PRINT "Full Name"
LOCATE 2, 25: PRINT "Telephone"
LOCATE 2, 37: PRINT "Address"
LOCATE 2, 50: PRINT "E-mail"
PRINT STRING$(80, "-")
LOCATE ct, 1: PRINT pcode
LOCATE ct, 6: PRINT pname$
LOCATE ct, 25: PRINT tel$
LOCATE ct, 37: PRINT add$
LOCATE ct, 50: PRINT email$
ct = ct + 1
tem = 1
END IF
WEND
CASE 4
ct = 4
LOCATE 11, 5: INPUT "Enter the address"; nadd$
CALL LOAD
CLS
WHILE NOT EOF(1)
INPUT #1, pcode, pname$, tel$, add$, email$
IF UCASE$(nadd$) = UCASE$(add$) THEN
LOCATE 2, 1: PRINT "Code"
LOCATE 2, 6: PRINT "Full Name"
LOCATE 2, 25: PRINT "Telephone"
LOCATE 2, 37: PRINT "Address"
LOCATE 2, 50: PRINT "E-mail"
PRINT STRING$(80, "-")
LOCATE ct, 1: PRINT pcode
LOCATE ct, 6: PRINT pname$
LOCATE ct, 25: PRINT tel$
LOCATE ct, 37: PRINT add$
LOCATE ct, 50: PRINT email$
ct = ct + 1
tem = 1
END IF
WEND
CASE 5
ct = 4
LOCATE 11, 5: INPUT "Enter the email"; nemail$
CALL LOAD
CLS
WHILE NOT EOF(1)
INPUT #1, pcode, pname$, tel$, add$, email$
7
1
LOADING . . . .
PLEASE WAIT
7
1
Main menu:
Date = 12-04-2009
09:19:34
Time
Telephone directory
==================
1. Add Records
2. Display All Records
3. Modify Record
4. Delete Record
5. Search record
6. Exit
Enter the choice (1-6)
Add:
Inserting the information
Code number? 1
Full name ? Bishal Heuju
Telephone ? 4910281
Address
? Narayantar
E-mail
? [email protected]
7
1
Load:
SEARCHING . . . .
PLEASE WAIT
Display:
Code Full name
Telephone
Address
----------------------------------------------------------------------------------------------------------------------------------1
2
3
4
Bishal Heuju
4910281
Narayantar [email protected]
Aaditya Pudasaini 4484050
Maijubahal
[email protected]
Abhishek Pudasaini 4451452
Thali
Hari Pd. Dhakal
9851025849 Biratnagar
[email protected]
Modify:
Modifying the members information
Enter the name? Hari Pd. Dhakal
Press C to change information
Code number
=4
Full name
= Hari Pd. Dhakal
Enter new name? Ram Pd. Dhakal
Telephone = 9851025849
Enter new telephone?
9841452649
Address
= Biratnagar
E-mail
= [email protected] Enter new e-mail?
[email protected]
Record modified successfully
09:25:19
New
New
New
New
New
code number = 4
name
= Ram Pd. Dhakal
telephone
= 9841452649
address
= Biratnagar
e-mail
= [email protected]
Delete:
Deleting the members information
What do you want to delete the records by?
1. Code no.
2. Name
3. Telephone
4. Address
5. E-mail
Enter your choice (1-5)? 1
7
1
SEARCHING . . . .
PLEASE WAIT
Telephone
Address
----------------------------------------------------------------------------------------------------------------------------------1
2
3
Bishal Heuju
4910281
Narayantar [email protected]
Aaditya Pudasaini 4484050
Maijubahal
[email protected]
Abhishek Pudasaini 4451452
Thali
-
Search:
7
1
SEARCHING . . . .
PLEASE WAIT
Telephone
Address
----------------------------------------------------------------------------------------------------------------------------------3
Thali
Exit:
7
1
CONCLUSION
I am very much satisfied with my computer project. I was able
to achieve my goals through it. Finally I was able to make a program
based on QBASIC. I had tried my best to make the program as versatile as
I was able. I tried hard to make the program reliable and error free. But
also there may be some error in the program. It is very simple program
based on QBASIC using the concept of file handling and modular
programming. It is a telephone directory which allows the user to add,
display, modify, delete and search records. I had also used some graphics
with the help of our computer teacher, Ram K. Thapa sir and the help file
of QBASIC.
At last I want to conclude my project here with the
thankfulness to all who had contributed and helped me directly as well as
indirectly to make this program successful. I hope that this program would
be an encouragement for me as well as our new QBASIC learners.
7
1