Check out the menu selection I did!!
Keys:
Up = w
Down = s
Select = Enter
If you want the code, please let me know
New Download Available.. Scroll Down
Check out the menu selection I did!!
Keys:
Up = w
Down = s
Select = Enter
If you want the code, please let me know
New Download Available.. Scroll Down
Last edited by Ruski; 10-06-2002 at 07:02 AM.
what does signature stand for?
Nice, but if I can make a suggestion, I would prefer to use the arrow-keys to select an option.
Last edited by ripper079; 10-06-2002 at 03:45 PM.
Yea.. that's what I tought, but I never used Arrow keys anywhere so I don't have experience yet..
what does signature stand for?
Here's the code & EXE. Have Fun!
what does signature stand for?
damn you and your windows.h!
(I'm in linux)
This is really cool dude! Thanks on showing me this.
Sweet code! Just replace those if/else statements with switch/case statements and it will look even more sweet!!!
I tried using it for my calc. program, and it gave me 102 errors all saying "cout is an abigious " thing *you know what I'm talking about*. I tried it in MSVC++ 6.0 changing iostream to iostream.h and taking out the namespace thing, and changed (added) stuff to the menu. Then I tryed it again in Dev-C++ *new download* and it still did the same thing.
Strange, I have modified the menu-system and it works. Donīt really know what the error is but I think is has something to to with multiple delcaration which the compiler is unable to choose the "right" one, for example when we have an overloaded function with a deafult value somthing like this
If you post some code it would be easier to helpCode:int func(int a); int func(int a, int b=10); int main() { //invoke which func ???? cout << func(5); return 0; }
Ruski:
- It looks like variable choice[0] is unitialised when you use it here:
>while (choice[0] != VK_RETURN)
- Continuing with choice, why is it an array, size 1? Not much point in having an array of 1 items when you don't need to.
- You have code in your header file. Ideally, you should have another .cpp file with the code in, leaving the declarations in the .h file. Then you link your main source with it when doing the compile.
- With regards to the if/else if comments above, it would be an idea if you simply stored the menu in an array (2d char, or string), and looped through it to display it. That way, you can have an int holding the current index number that is being highlighted. Doing this would remove most of the if/else if statements. Here's something for you to ponder over:
Code:#include <iostream> #include <string> using std::cout; using std::endl; using std::string; int main(void) { string mymenu[] = {"Option 1", "Option 2", "Option 3"}; int HighlightMe = 1; for (int i = 0; i < sizeof (mymenu)/sizeof mymenu[0]; i++) { if (i == HighlightMe) cout <<"-->"; else cout <<" "; cout <<mymenu[i] <<endl; } return 0; }
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
I've compiled the code in Dev-C++ 5b and didn't have any errors/problems... It could be that I don't have much experience using CHARs so I did choice[0] etc...
There are no copyrights, so feel free to use, edit, delete the code
what does signature stand for?
That's probably why. I'm in MSVC++ 6.0