Computer Science Canada Help with strings |
Author: | 5had0w [ Sun Jun 04, 2006 3:48 pm ] | ||
Post subject: | Help with strings | ||
This is a program that I'm making for school. This will connect to a parallel port eventually. I do not need any help with that. I am looking for help with my strings. I would like it to be able to take in more than one number and display them with a delay. I would also like for it to be able to display letters. If any of you could help it would be greatly appreciated. Here is my code.
|
Author: | TheOneTrueGod [ Sun Jun 04, 2006 9:22 pm ] | ||
Post subject: | |||
I don't think theres really that much better of a way to do this really... You're just going to have to use drawn-out if clauses. You could try proceduralizing it, and passing parameters, for example:
Other than that, I really don't see what you're asking... You're just going to have to figure out how to make it look like an "a", how to make it look like a "b", etc... |
Author: | 5had0w [ Sun Jun 04, 2006 9:30 pm ] |
Post subject: | |
The part that I'm asking is how I can get my string to let me put letters in an if statement after the get command. I don't know how to use letters in my if statements. I've tried switching it to just get from getch but I still couldn't get it working. The other thing I'm asking is how I can type in a line of numbers eg. a phone number and have it display them one at a time with a delay in between. Thanks for the help |
Author: | TheOneTrueGod [ Sun Jun 04, 2006 9:48 pm ] | ||||
Post subject: | |||||
ok, thats a more specific question I can answer. strings can be parsed just by using parenthesisYour welcome wtd ![]()
same with the phone number..
and that hunk of barely legible code should show you what to do ![]() |
Author: | 5had0w [ Sun Jun 04, 2006 10:46 pm ] | ||
Post subject: | |||
Okay so its getting late and I've modified my program with a lot of help. This is my current program.
I still can't get one number to show up; have it stay there for a bit and then go to the next number. Please tell me what I'm doing wrong (I do realize there isn't much code for the second number. Like I said its late) Thanks for all the help and looking forward to more |
Author: | TheOneTrueGod [ Mon Jun 05, 2006 6:47 am ] |
Post subject: | |
You want to have a for loop around the different characters. for i : 1..length(ch) if ch(i) = "1" then %Etc, drawn out if here ... end if delay(1000) end for |
Author: | wtd [ Mon Jun 05, 2006 10:24 am ] |
Post subject: | |
TheOneTrueGod wrote: strings can be parsed just by using parenthesisYour welcome wtd
![]() Now, just spell "you're" correctly and I'll be happy. Oh, and what you're doing idn't exactly what I'd call "parsing." Raher you're "indexing" the string. |
Author: | 5had0w [ Mon Jun 05, 2006 4:04 pm ] | ||
Post subject: | |||
ok so i've got almost everything that i want for this to work how i want it too. The code now looks like this
The only other thing I want it to do is have it so i can put more than one word and have it go to the next word after the space and continue after the space. eg. Hello my name is rather than: Hello my name is |
Author: | 5had0w [ Mon Jun 05, 2006 4:04 pm ] | ||
Post subject: | |||
ok so i've got almost everything that i want for this to work how i want it too. The code now looks like this
The only other thing I want it to do is have it so i can put more than one word and have it go to the next word after the space and continue after the space. eg. Hello my name is rather than: Hello my name is |
Author: | 5had0w [ Mon Jun 05, 2006 4:06 pm ] |
Post subject: | |
i dont know why it posted twice but they are the same thing sorry guys ![]() |