AllExperts > Experts 
Search      

Qbasic, Quickbasic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Qbasic, Quickbasic Answers
Question Library

Ask a question about Qbasic, Quickbasic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Don Schullian
Expertise
I`ve worked in BASIC since the Commodore days and maintain a web site part of which is devoted to helping others with thier problems. I`m proficient in all versions of PowerBASIC but cross over to QuickBASIC and Qbasic frequently.

 
   

You are here:  Experts > Computing/Technology > Basic > Qbasic, Quickbasic > Writing A Game Show

Topic: Qbasic, Quickbasic



Expert: Don Schullian
Date: 5/15/2008
Subject: Writing A Game Show

Question
QUESTION: Hey All,

I'm trying to learn how to mess with Qbasic. Right now I think I know the basics but I'm having trouble putting my program together.

Basically I want my program to:
1. Ask a Question
2. Player A and then Player B Answers
3. If A or B or both is right, I want the program to add points to the player's total score.
4. Then move on to Question 2 and so forth.

Thanks,

Johnny.


ANSWER: Hi,

 Your question/request is a bit broad to answer the whole thing here so I'll give you an outline then, if need be, we can deal with specific points as they arrise.

You'll need a data base of questions and answers. Your best bet is to use true/false or multiple choice. Essay questions are too difficult to grade. How ever many answers a question has you'll want to put the correct answer as the 1st one stored then shuffle the answers before presenting them.

You'll need to have a short loop for the number of players. Each player will have an element in an array to keep track of the number of correct answers. (Wrong answers can be computed from the total number of questions asked)

This should get you started. Let me know if/when you need some more.


---------- FOLLOW-UP ----------

QUESTION: Hey,

First and foremost, thanks for the quick reply/response. The program I am trying to run is a trivia type with 5 to 10 questions the most. The questions are as simple as "What's the State Capitol of California?" The value would be 5 points if they get it right. I will have to use the input statement to let Player A and B enter their answers.

I kind of sat down today and wrote a very vague outline of the statements and functions I might need for this program. The list goes:

Print Statement
Let Statement - To calculate the total points earned.
Input Statement -  To let Player A and B enter their Answer
Open Statement
Close Statement
Input Statement - Read Data from the file
While Statement
If Statement
EOF Statement

I also know that I would need 3 fields. The first would be the question, the second would be the answer and the third would be score or value of getting the right answer.

Let's take it back a step and use this for an example:

What is the State Capitol of California?
Sacramento
5

Something like that.

I would also like to thank you for your help and I hope this is more specific.

Thanks
Johnny



ANSWER: Hi,

 Looks like you're on your way. I don't know what it is you want me to do. I can't write the program for you here.


---------- FOLLOW-UP ----------

QUESTION: Hey,

How would the placement of these statement/functions go? I know my outline is not in the right order and I'm trying to figure what statement/function goes before the other.

Answer
You'll need a loop until either player wins or you run out of questions.
read the question and answer into variables
print the question for the player
get the answer
test answer from player against the correct answer (use UCASE here)
report correct/wrong
if correct award points
loop to next player or question

Johnny, send some code if you've got any more questions. This is starting to look like homework.

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.