Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-09-2014, 02:51 AM #1
- Join Date
- Dec 2013
- Thanked 0 Times in 0 Posts
just need a little help, on a code
So, the problem I'm having is that I want to make a code, but i don't where to start. The code is going to randomly pick 2 questions, that are provided, and when you answer both right you move on. So for example I would write 50 questions and the answer for them, and then when you start the code up, it will asks you 2 of the 50 questions and when you get the 2 questions, right you'll move on. So if anyone could help me out, by explaining in the comments or by put a link to a video explaining it, anything would be appreciated. Thanks
01-09-2014, 07:19 AM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,538 Times in 2,516 Posts
One more time, this forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others, but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.
So you are quite entitled to "a little help", but not to have someone do your homework for you.
What resources have you tried so far?
Rather than pick questions at random (which means that the same question may appear twice), you will need to shuffle the questions into random order and then take the first two, the next two and so on. This means that the answers must be in the same array index as the question, and separated out by splitting at the delimiter. Example:-
var myQuestions = ;
myQuestions = "Who wrote Romeo and Juliet?~~Shakespeare";
myQuestions = "Who is the President of the USA?"~~Obama";
myQuestions = "How many beans make 5?~~5";
// and so on.
The array will need to be shuffled into random order, or it would be simpler to just present the questions in sequential order. Get that right first, then add the refinement of shuffling.
You will also need to keep a count of the number of correct answers.
Use the search facility of this forum for guidance.
But I have the idea that this assignment is too difficult for you at this stage in your programming development. You are trying to run before you can walk. You say that you are 8th grade - which I understand is age 12-14.
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Last edited by Philip M; 01-09-2014 at 08:15 AM. Reason: typo
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.