User Name Password Register
DaniWeb IT Discussion Community
All
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 402,030 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,444 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.
Views: 3198 | Replies: 15
Reply
Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #11  
Apr 23rd, 2007
from i what i saw in your code you read from the file with questions and print the question on screen. now, why you don't read the entire file, built that array of records, apply the randomize and then put a question from that array?

e.g: ado is that array of records.

randomize;
cycle
put_question: ado[random(i)+a_value]
end_of_cycle

i hope you understand the principle.

best regards,
Reply With Quote  
Join Date: Apr 2007
Location: Glasgow
Posts: 32
Reputation: adotl is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adotl's Avatar
adotl adotl is offline Offline
Light Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #12  
Apr 23rd, 2007
Yes I fully understand now, thanks for your help mate!

I'll go away and try this.
edit
Im pretty sure Cycle is a mac extension but Continue does exactly the same and the main reason was to understand your point for which Im grateful.
Last edited by adotl : Apr 23rd, 2007 at 10:41 am.
Reply With Quote  
Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #13  
Apr 23rd, 2007
ok, i'm sorry for my mistake, i only tried to explain it in a pseudocode manner.

so,

e.g: ado is that array of records.

randomize;
cycle//this can be a while, repeat,ect. you must think until when this cycle is going.
put_question: ado[random(i)+a_value]
end_of_cycle

hope that now is more obvious

best regards,
Reply With Quote  
Join Date: Apr 2007
Location: Glasgow
Posts: 32
Reputation: adotl is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adotl's Avatar
adotl adotl is offline Offline
Light Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #14  
Apr 23rd, 2007
Yep thats great, I totally get it and I thank you again for your help!
Reply With Quote  
Join Date: Dec 2006
Location: Romania
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #15  
Apr 24th, 2007
Originally Posted by adotl View Post
Yep thats great, I totally get it and I thank you again for your help!


this is the scope of a forum, to help between us. now i will ask you then when the program is finished to post it here so when a begginer will search the same thing to find it and learn from it

best regards,
Reply With Quote  
Join Date: Apr 2007
Location: Glasgow
Posts: 32
Reputation: adotl is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adotl's Avatar
adotl adotl is offline Offline
Light Poster

Re: Pascal : Access a file of 100 Quiz questions so 12 Random ones are displayed?

  #16  
Apr 24th, 2007
Sure but its not going to be done for a while cos I have a big exam to study for and as I stated at the start my program already meets the project requirements so I'll just hand it in without the random function.

Although I plan to do the random feature after my exam (end of May) and when it is done I will happily post it up here.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Pascal and Delphi Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 10:30 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC