Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question

Status
Not open for further replies.

subclubkid

Programmer
Oct 21, 2002
3
US
Hello,
I just recently got back into Qbasic and was working on little things to spark my memory. Anyways I was trying to make a "Test" program that asked all the questions at the end of a chapter in "Qbasic by Example".

I can get everything going just fine, save for a little problem dealing with "variety" within an answer.

Like if the question asks "What does RAM stand for?"

There is only one right answer, but many ways of writting it.

So how can I go about making it so a variety of answers are allowed.?

Thanks in advance for any help

sorry also if this is a Newbie question:)

-Mike

 
For questions like this where there is only one correct answer you can write the correct answer in a variable as "randomaccessmemory" What you can do then is take the users answer, strip out everything except A-Z and a-z. Force the resulting string into lowercase and compare the the string to your correct answer.

In several questions you'll probably have more than 1 correct answer, you'll have to come up with all the correct possibilities and test them all.

If you want to take spelling mistakes into consideration, such as "randum" for "random" you could try a Soundex algorithm.

I've got a couple of text matching routines (including Soundex)on my page at
You have to decide just how far you want to go into checking whatever the user types in before saying it's right or wrong.

A simpler method may be to use multiple choice questions. For example the queston you ask in your post could have the following as possible answers

A Read Any Memory
B Random Access Memory
C Random Array Memory
D Read Array Module

Ray
 
Hey,
Thanks for the response.

I knew I could do the multiple choice thing, but figured that would be cutting corners.

I'll give that random thing a try later on, and that spelling is a good idea I didnt even think about.

Thanks for the help:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top