Computer Science Canada Utilising data files with arrays to make a quiz |
Author: | tristanbryce7 [ Sat Jan 12, 2013 5:39 pm ] | ||||||||
Post subject: | Utilising data files with arrays to make a quiz | ||||||||
Hello , I Am making a quiz with 3 levels of difficulty and each level having 10 questions each, i Have an idea to use data files plus arrays to make my code much more efficient, but am stuck on how to do it. What i plan on doing is make a data file for "Easy Level" questions (and both other levels), and on top of that, i plan to make 4 other data files for Easy,(one which would be EasyLevelA, where all of them are the "A" options for the respective questions. For example "easylevelqtns.t" would be like this
and "easylevelanswerA.t" would be like
where Johnny is option A for the question "What is Dr whos real name" and so on, and i plan on doing this for options B,C,D as well. So what i had in mind was to make an array for each of those so i could read them off the data file i create
and so on, for each level of difficulty, id make a new data file, and then read them and display them on the screen using Font.Draw like
and so forth, I know I might be a bit unclear as to what i want, and if you don't understand, I can further clarify if you need to, but I was really hoping that i could try this, And if it could be acheived or if there is an even faster way i would love to know about it. Any help would be greatly appreciated ![]() |
Author: | Panphobia [ Sat Jan 12, 2013 6:20 pm ] |
Post subject: | RE:Utilising data files with arrays to make a quiz |
Are you asking us to make your code for you, or do you need help with something, here is a good tutorial on data files http://compsci.ca/v3/viewtopic.php?t=12972&highlight=data , and you don't need to have different data files for levels you could have Easy as a start of a record, and then EasyLevelA,B,C as fields with the question and answers under them, and then do the same with medium and hard |
Author: | tristanbryce7 [ Sat Jan 12, 2013 6:36 pm ] |
Post subject: | Re: Utilising data files with arrays to make a quiz |
Nope, i was hopping for a step in the right direction, and yah I figured out something, I'm only using three data files now (one for easy, medium, hard) and each one contains the questions and answers within it ![]() |
Author: | Raknarg [ Sat Jan 12, 2013 10:56 pm ] |
Post subject: | RE:Utilising data files with arrays to make a quiz |
I'm mobile right now so I can't help yet (too much typing :p), but as a suggestion you could use a single multidimensional array for the options instead of four arrays... Simplifies your life and it's good coding practice in this case |