•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 391,555 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,613 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser:
Views: 2365 | Replies: 7 | Solved
![]() |
•
•
Join Date: Jan 2007
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 0
hey im lost, so was wondering if anyone would help me. Im doing a program for a DVD rental system. When it comes to searching the rentals by ID, I cant seem to make it show all the DVD's that the customer has rented not only one. I dont know if I was clear enough so here's the procedure I wrote:
procedure SEARCH_RENTAL_ID (s:string);
begin
found := false;
seek(r,0);
if (filesize(r) = 0) then
writeln(' Currently there are no entries in this file')
else begin
while not(eof(r)) and (found = false) do
begin
read(r,rr);
if (rr.ID) = s then
begin
writeln;
writeln(' ID.................',rr.ID);
writeln;
writeln(' ISBN...............',rr.ISBN);
writeln;
writeln(' Rental Type........',rr.rental_type);
writeln;
writeln(' Date Out...........',rr.date_out);
writeln;
writeln(' Date In............',rr.date_in);
found := true;
end;
end;
if found = false then
begin
textcolor(yellow+blink);
writeln;
writeln;
writeln(' *** HAS NO RENTALS YET ***');
textcolor(yellow);
end;
end;
end;
the only thing I need I suppose is a loop to display all the rentals the member has but I cant manage to do it. If anyone knows pls help me tnx
procedure SEARCH_RENTAL_ID (s:string);
begin
found := false;
seek(r,0);
if (filesize(r) = 0) then
writeln(' Currently there are no entries in this file')
else begin
while not(eof(r)) and (found = false) do
begin
read(r,rr);
if (rr.ID) = s then
begin
writeln;
writeln(' ID.................',rr.ID);
writeln;
writeln(' ISBN...............',rr.ISBN);
writeln;
writeln(' Rental Type........',rr.rental_type);
writeln;
writeln(' Date Out...........',rr.date_out);
writeln;
writeln(' Date In............',rr.date_in);
found := true;
end;
end;
if found = false then
begin
textcolor(yellow+blink);
writeln;
writeln;
writeln(' *** HAS NO RENTALS YET ***');
textcolor(yellow);
end;
end;
end;
the only thing I need I suppose is a loop to display all the rentals the member has but I cant manage to do it. If anyone knows pls help me tnx
Last edited by exotic_ang : Jan 13th, 2007 at 7:18 am.
•
•
Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation:
Rep Power: 2
Solved Threads: 16
•
•
•
•
hey im lost, so was wondering if anyone would help me. Im doing a program for a DVD rental system. When it comes to searching the rentals by ID, I cant seem to make it show all the DVD's that the customer has rented not only one. I dont know if I was clear enough so here's the procedure I wrote:
procedure SEARCH_RENTAL_ID (s:string);
begin
found := false;
seek(r,0);
if (filesize(r) = 0) then
writeln(' Currently there are no entries in this file')
else begin
while not(eof(r)) and (found = false) do
begin
read(r,rr);
if (rr.ID) = s then
begin
writeln;
writeln(' ID.................',rr.ID);
writeln;
writeln(' ISBN...............',rr.ISBN);
writeln;
writeln(' Rental Type........',rr.rental_type);
writeln;
writeln(' Date Out...........',rr.date_out);
writeln;
writeln(' Date In............',rr.date_in);
found := true;
end;
end;
if found = false then
begin
textcolor(yellow+blink);
writeln;
writeln;
writeln(' *** HAS NO RENTALS YET ***');
textcolor(yellow);
end;
end;
end;
the only thing I need I suppose is a loop to display all the rentals the member has but I cant manage to do it. If anyone knows pls help me tnx
the problem in your code is that when you find one rental you stop the loop. why? you need to get all the rentals no?
if you are unsure about what i'm saying try to run your code step by step, watch the variables and i'm sure you'll undestand
best regards,
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Pascal and Delphi Marketplace
Similar Threads
- Searching a record in 3 tables (Visual Basic 4 / 5 / 6)
- Searching for a record in multiple tables (VB.NET)
- Problem with Listbox (Visual Basic 4 / 5 / 6)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: BST and SIGSEGV
- Next Thread: saving in record prob


Linear Mode