Computer Science Canada Word Length Comparison |
Author: | Fashoomp [ Tue May 22, 2007 11:47 am ] |
Post subject: | Word Length Comparison |
What if...lets say i wanted a program, where you enter in 10 words. How could turing find out which of those words is the longest? i assume it has something to do with a for loop, and length (word). And an array...i just cant figure out how to put it together. |
Author: | PaulButler [ Tue May 22, 2007 12:10 pm ] | ||
Post subject: | RE:Word Length Comparison | ||
No need for an array, just store the longest word in a variable and for each word the user types, set that variable to the typed-in word if it is longer. For example, (I don't know Turing, so this is pseudocode):
|
Author: | Shades [ Thu May 24, 2007 2:44 pm ] | ||
Post subject: | Re: RE:Word Length Comparison | ||
I have this, as my program for an assigment, and since it's related, I'll just show you here:
So yea, when I try and run it it works, up until the part where the length checkers come in, it highlights the first for loop of the series of 4 , and says "Variable has no value" |
Author: | Carey [ Fri Jun 01, 2007 8:19 am ] |
Post subject: | Re: Word Length Comparison |
its because there is nothing in the 2nd spot of the info array. |