Computer Science Canada Phone number using - |
Author: | xmdxtreme [ Tue May 11, 2004 7:38 pm ] |
Post subject: | Phone number using - |
Ok one part of my program i want to do this when you type like a phone number 4162340942 the dashes pops up by it self like first 3 digits then a dash pops up: 416- then you type 416-234- another dash pops up... like that plz help me i dont have much time ![]() btw:if you dont understand sorry for bad english ![]() |
Author: | Paul [ Tue May 11, 2004 8:05 pm ] | ||
Post subject: | |||
|
Author: | xmdxtreme [ Tue May 11, 2004 8:08 pm ] |
Post subject: | |
thank you it helped alot ![]() |
Author: | xmdxtreme [ Tue May 11, 2004 8:36 pm ] |
Post subject: | |
but the user can type letters lol i know for phone numbe its ok but for date i change it to slashes and fixed up the loop and mod for it but they can type letters anyway to prvent that? |
Author: | Paul [ Tue May 11, 2004 8:41 pm ] | ||
Post subject: | |||
well ord("0") is 48 and ord("9") is 57 then
|
Author: | xmdxtreme [ Tue May 11, 2004 9:29 pm ] |
Post subject: | |
sorry its my first year i dont get this can someone explain this or be a bit more specific sorry man ![]() |
Author: | Paul [ Wed May 12, 2004 3:24 pm ] |
Post subject: | |
all characters has its on code, ASCII? I think, anyhow, in the code above, it specified that if the code of the numbers entered is between 0 and 9 then, it exits the loops, or else (its not a number) it keeps asking for input. |
Author: | xmdxtreme [ Wed May 12, 2004 4:28 pm ] | ||
Post subject: | |||
it doesnt work i even tried changing the code like this:
|
Author: | we64 [ Wed May 12, 2004 4:52 pm ] | ||
Post subject: | |||
to prevent not entering letters:
|
Author: | Tony [ Wed May 12, 2004 4:56 pm ] | ||
Post subject: | |||
... ![]()
|
Author: | Paul [ Wed May 12, 2004 5:08 pm ] |
Post subject: | |
I like mine better tony, mine remebers the phone number ![]() |
Author: | xmdxtreme [ Wed May 12, 2004 5:12 pm ] |
Post subject: | |
sorry one more thing last question ![]() put phonenumber I mean i just want to save the final phone number entered including dashes to a variable how? |
Author: | Paul [ Wed May 12, 2004 5:14 pm ] | ||
Post subject: | |||
uh... my code already does it, or rather we64's modified code, just go
|
Author: | xmdxtreme [ Wed May 12, 2004 5:17 pm ] |
Post subject: | |
nvm lol edit i asked a stupid question thank all of you guys you helped me alot ![]() |
Author: | xmdxtreme [ Wed May 12, 2004 8:13 pm ] |
Post subject: | |
lol omg another question sorry guys ![]() |
Author: | Paul [ Wed May 12, 2004 8:14 pm ] |
Post subject: | |
yea its getch so just ask the user at the end, if they had a mistake and would like to reenter the number, then if yes restart loop, reset all values. and cls |
Author: | xmdxtreme [ Wed May 12, 2004 8:22 pm ] |
Post subject: | |
yeah thats a way but my teacher was like you better error proof completely but is there any other way i can acctually use backspace i just knw char value for backspace is 8. |
Author: | Paul [ Wed May 12, 2004 8:24 pm ] |
Post subject: | |
well u can do it in a roundabout way, have an if statement that if backspace is detected, then erase the last letter in the variable of "num" and then use locate to put a space where u wrote last. |
Author: | xmdxtreme [ Wed May 12, 2004 8:36 pm ] |
Post subject: | |
yeah ill look into that thx ![]() |
Author: | we64 [ Wed May 12, 2004 8:58 pm ] |
Post subject: | |
you can't minus strings.... I think |
Author: | Paul [ Wed May 12, 2004 9:10 pm ] |
Post subject: | |
yea you can num:= num(1..*-1) |
Author: | we64 [ Wed May 12, 2004 9:22 pm ] |
Post subject: | |
oh I see, forgot it, let's try |
Author: | we64 [ Wed May 12, 2004 9:35 pm ] | ||
Post subject: | |||
everything works, except it can't erase the dash, I mean it can, but if you do, it will mess things up.... someone try to figure it out, I got other English work to do tonight, so I will leave it like this......
|
Author: | xmdxtreme [ Wed May 12, 2004 10:16 pm ] |
Post subject: | |
thank you now someone else help plz ![]() |
Author: | we64 [ Thu May 13, 2004 6:44 am ] | ||
Post subject: | |||
finally, here now it works well I hope....
|