
-----------------------------------
versE91
Sun Apr 13, 2014 4:14 pm

True or false quiz program
-----------------------------------
What is it you are trying to achieve?
Trying to create a true or false quiz


What is the problem you are having?
Doesn't display 1/5, 2/5, 3/5 and 4/5 in percentage. It only tells you if you got perfect or if you failed the quiz entirely. If you don't understand what I am saying, run the file.


Describe what you have tried to solve this problem
Haven't tried anything yet


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
I will post the file.



N/A



Please specify what version of Turing you are using
4.1.1

-----------------------------------
Dreadnought
Sun Apr 13, 2014 6:14 pm

Re: True or false quiz program
-----------------------------------
/ performs [tdoc]real[/tdoc] division and returns a real number.

Note that since you want a percentage you can do what you want with [tdoc]div[/tdoc], just make sure you multiply by 100 before dividing (that way you don't lose any information from the truncation)

-----------------------------------
versE91
Tue Apr 15, 2014 4:14 pm

RE:True or false quiz program
-----------------------------------
Ok fixed it, works like a charm now. Out of curiosity, is there a way I could create this program with fewer lines?

-----------------------------------
Insectoid
Tue Apr 15, 2014 5:06 pm

RE:True or false quiz program
-----------------------------------
There's absolutely a way to reduce the number of lines. You can move all of the questions to a separate text file and write a single procedure that takes the question and answer as input which prompts for an answer, checks it, outputs a message, and updates the score. Put that in a loop and you can add as many questions as you can think of without changing a single line of code.

-----------------------------------
Tony
Tue Apr 15, 2014 5:08 pm

RE:True or false quiz program
-----------------------------------
You don't need to type out the same
not true, depending on the interpretation of the question -- http://www.snopes.com/food/ingredient/carrots.asp

-----------------------------------
TWizard
Thu May 08, 2014 2:27 pm

RE:True or false quiz program
-----------------------------------
Well, with out using file statements you can still reduce lines, by using a for statements. I'd like to recommend looking at what people "might" input, for example, if someone starts using y/n for some odd reason, the program would just fail out.

Also using a loop and clever thinking you could make this repeatable, and possibly random questions!. A fun experience.
