Computer Science Canada "get" help |
Author: | foo fighter [ Wed Nov 23, 2005 11:48 am ] |
Post subject: | "get" help |
how do i make a get command where the user doesn't have to press enter after typing in a word or number or somethin like that ![]() |
Author: | Tony [ Wed Nov 23, 2005 11:51 am ] | ||
Post subject: | |||
works for a single character. If you put getch() in a loop, you could get whole words |
Author: | foo fighter [ Wed Nov 23, 2005 12:18 pm ] |
Post subject: | |
alright well i understand how the strings work but it doesnt seem to work with int this is what ive tried: var number : int (1) getch number[/b] |
Author: | Tony [ Wed Nov 23, 2005 12:20 pm ] |
Post subject: | |
it works for characters only. if you want a digit, you getch() it as a character, and then strint() convert it to a digit |
Author: | foo fighter [ Wed Nov 23, 2005 12:32 pm ] |
Post subject: | |
could i get an example, cause i'm not familiar with strint commands |
Author: | Tony [ Wed Nov 23, 2005 12:35 pm ] | ||
Post subject: | |||
|
Author: | Albrecd [ Wed Nov 23, 2005 1:19 pm ] | ||
Post subject: | |||
Try that |
Author: | foo fighter [ Wed Nov 23, 2005 5:34 pm ] |
Post subject: | |
Ok im done with getch stuff. now i have a new problem, i cant divide integers take at look: var bi, binary : int put "Enter a number: " get bi binary := bi / 2 when i divide by 2, i get "assigned value wrong type" 2 is high-lighted |
Author: | Cervantes [ Wed Nov 23, 2005 6:37 pm ] | ||||
Post subject: | |||||
That's because binary is an integer. But division using / returns a real number. (Think: 13 / 2). Alternatives are to use div, as in
Or use round, as in
|