![]() |
|
array of string problem |
chin jiunn gai
Member #6,753
January 2006
|
i use c language. get the key input 1 or 2 or 3 from user |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
I'd store integers in the table and use atoi to convert the user input to an interger. OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Pedro Avelar Gontijo
Member #5,372
January 2005
![]() |
I really didn't understand what you want to do... but in any case Fladimir's tip should do it Fladimir da Gorf's sig said: The final testing of OpenLayer 2.0 is underway! (Yet another Framebuffer issue solved)
Considering you're changing your sig very instensely, I guess OpenLayer 2.0 is just getting the last hits on the anvil? ---------- |
chin jiunn gai
Member #6,753
January 2006
|
my question not only integer but string ,example which is the longest rivers |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
Then use strcmp instead of the == operator to test the equality of strings. If you want to get really fancy you could also ignore case and strip the trailing and leading spaces from the input etc. Quote: Considering you're changing your sig very instensely, I guess OpenLayer 2.0 is just getting the last hits on the anvil?
Maybe OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
chin jiunn gai
Member #6,753
January 2006
|
so how what code i should write to convert my input to string ? i am use the allegro for the input .and my input either 1,2 or 3 only |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
The best way would be to use a real GUI. But if you want to do it by yourself here's a quick article about it. OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
chin jiunn gai
Member #6,753
January 2006
|
that article just for text input . and i want to ask is this the way to do the quiz game . store the question and answers in array then compare the user input with store answers ... is that something i omit |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
You're reading only one key, not a string. But as you have predefined choises to choose from, that's enough. To convert a char to a string you could use the age old trick:
OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
|