₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,362 members, 8,511,507 topics. Date: Sunday, 01 November 2026 at 07:18 PM

Toggle theme

Need A Little Help On A Qbasic Code - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Need A Little Help On A Qbasic Code (979 Views)

1 Reply

Need A Little Help On A Qbasic Code by Capnd143(op): 4:44pm On Jul 18, 2016
ok.. i have this qbasic assignment were i am supposed to open a random & record file, store the salaries of four employees and the read and print the content of the file... but after running the program, i keep getting and additional empty record at the end of the file... how do iget rid of it; this is my code;

CLS
REM " AN EXERCISE ON RANDOM FILES "
REM "PROGRAM WRITTEN BY AKPAN, TIMOTHY MAXWELL. A CSC101 STUDENT"

TYPE employeeType
ename AS STRING * 10
BS AS INTEGER
HA AS INTEGER
AA AS INTEGER
END TYPE

DIM employee AS employeeType
phase:
PRINT " [1] create a new recordset"
PRINT " [2] view existing recordset"
INPUT "please type either [1] or [2]....", value%

IF value% = 1 THEN
OPEN "dats1.txt" FOR RANDOM AS #1 LEN = LEN(employee)
INPUT "How many records do you want to create", recnum%
FOR i = 1 TO recnum%
CLS
INPUT "Employee Name:", employee.ename
INPUT "Basic salary:", employee.BS
INPUT "Hazard Alowance:", employee.HA
INPUT "A.Allowance:", employee.AA
IF i = recnum% THEN EXIT FOR

PUT #1, , employee
NEXT i

CLS
CLOSE #1
value% = 2

END IF

IF value% = 2 THEN
PRINT "name", " basic salary ", " hazard allowance", "a.llowance"
OPEN "dats1.txt" FOR RANDOM AS #1 LEN = LEN(employee)
DO WHILE NOT EOF(1)
GET #1, , employee
PRINT employee.ename, employee.BS, employee.HA, employee.AA
LOOP
CLOSE #1
GOTO phase
END
END IF




Re: Need A Little Help On A Qbasic Code by Capnd143(op): 5:35pm On Jul 18, 2016
no help? come on!!!!!!!!!!!!!!!
1 Reply

I'm Having A Problem With This Qbasic. Who Can Help? • Can A Vast Qbasic Programmer Do This? • Learn Qbasic Programming Language In 14 Days • 2 • 3 • 4

As Being A Nairaland Member I Would Like To Share This For Software Website • About Rejoice (history Of Medicine) • Naijabrainners Is Formally Know As Micksblog