Computer Science Canada Another help in recognition! |
Author: | DBZ [ Thu Dec 25, 2003 7:34 pm ] |
Post subject: | Another help in recognition! |
Hey guys, i need this program to be able to recognize wether the user input is a number, a letter, or a sign. For example, if i enter "55te+-", the program should output, 55 is a number, te is a letter, +- is a symbol. Please try ur suggestion in the program and repost the program here! Here is the program: var word,t:string const numbers:="0123456789" const symbols:="`~!@#$%^&*/*-+" put"enter a word: ".. get word for i:1.. length(word) var v:=word(i) put v if v= numbers then put" is a number" elsif v=symbols then put v, " is a symbol" end if end for |
Author: | Thuged_Out_G [ Thu Dec 25, 2003 9:03 pm ] | ||
Post subject: | |||
|
Author: | AsianSensation [ Thu Dec 25, 2003 10:54 pm ] | ||
Post subject: | |||
you have the right idea, but learn to use the index function. index each individual substring in the const values you declared. If the position returned is not 0, then you found it, and you can output accordingly.
same thing for letters and symbols. |
Author: | DBZ [ Fri Dec 26, 2003 7:02 pm ] |
Post subject: | |
Hye thanx a lot guyz! I really apreciate ur help! |