Author |
Help |
Tarnekep Grand Admiral Galactic Navy
Joined: October 17, 2003 Posts: 275
| Posted: 2006-04-18 14:10  
Does anyone know what my teacher is trying to tell me here it just trying to understand him for my test i don't want anyone to do it just an explanation of what he wants:
Build a form which does the following:
1) Allows the user to enter two words for comparison.
2) Uses a user-defined function to evaluate the words and return the word which comes first alphabetically.
3) Accurately picks the correct answer no matter how long the words are (e.g. it should know that "wolf" comes before "wolverine").
4) Adds the result to a listbox and prompts for another pair of words.
5) Has a mechanism to clear the previous entries and start over.
6) Has a blue form background.
The only question I really don't understand what he wants are question 2-3 the others i do understand.....does anyone know....this is Access VBA if anyone know that program.
Thanks Tarnekep
_________________
|
Fattierob Vice Admiral
Joined: April 25, 2003 Posts: 4059
| Posted: 2006-04-18 15:24  
I don't know what language your using, but their should be a mighty easy way to compare two strings/chars alphabetically. google it. (user defenied function == method)
as for knowing if "wolf" is greater then "wolvernine", just use a for loop that iterates through each char of the string and checking if one of them comes first alphabetically.
_________________
|
Doran Chief Marshal Galactic Navy
Joined: March 29, 2003 Posts: 4032 From: The Gideon Unit
| Posted: 2006-04-18 16:53  
Quote:
|
On 2006-04-18 14:10, Tarnekep wrote:
2) Uses a user-defined function to evaluate the words and return the word which comes first alphabetically.
3) Accurately picks the correct answer no matter how long the words are (e.g. it should know that "wolf" comes before "wolverine").
|
|
as i read it, the program is to take the 2 input words and sort them alphabetically. #2 and #3 are fairly similar, #2 would be the meat&potatoes of the code and #3 would just be error-checking.
process wise, id think that something like
- convert each input word into an array of characters
- loop thru array with a for loop, check for which array has the letter in [array element #] that comes first
- use some place holder variables to store the array name (and thus the users input) of which comes First and Second (alphabetically)
- reconsitute the character arrays back into strings and output them into textboxes or lables or however you're doing it
but thats just me
_________________
|
Shigernafy Admiral
Joined: May 29, 2001 Posts: 5726 From: The Land of Taxation without Representation
| Posted: 2006-04-18 17:16  
Basically, two says:
Write a function that returns the word which would come first alphabetically.
Three, as Doran points out, is basically error checking: making sure it won't fail if the words are different lengths.. so you'd put in a check to make sure there are still letters, basically.
Also:
By default - at least with languages I use - if you compare a char() type check of the letters, you might get some errors because of capitalization.
Thus, I'd assign new vars which hold the lowercase version of the string (in php at least, that'd be strtolower) and then compare those variables. That way you don't get thrown off by an errant capital letter somewhere.
_________________ * [S.W]AdmBito @55321 Sent \"I dunno; the French had a few missteps. But they're on the right track, one headbutt at a time.\"
|
Lord DowneyBUM (UK) Fleet Admiral
Joined: January 13, 2003 Posts: 437 From: London England
| Posted: 2006-04-19 05:22  
/me head explodes.
_________________ ,
|
Joe dirt Fleet Admiral
Joined: April 18, 2006 Posts: 273
| Posted: 2006-04-19 10:18  
is lost and clueless
_________________
|