A clean and easy to use header file for a selection menu with arrow keys and return values.
The code is designed so that you can modify it yourself without much difficulty.
However, everything works out of the box.
- Toggle with ↑↓ and select with →
- Up to any amount of selection options you want
- Get return values
- Customize color
- Customize header
- Easy to use
Simply download the file and then insert it into the desired directory.
Next, add #include "menuclass.h"
at the beginning of the instance you want to run.
Use the menu
keyword to create a menu first.
Then use .setTitle()
to add option titles.
Next, use .chooseTitle()
to let the user choose an option and to get the return value.
You can use .ModeToSet
to store the return value as integer.
int main(){
menu home;
home.setTitle(" Option ~~~~~~~~~~ 1 ");
home.setTitle(" Option ~~~~~~~~~~ 2 ");
home.setTitle(" Option ~~~~~~~~~~ 3 ");
home.setTitle(" Option ~~~~~~~~~~ 4 ");
home.setTitle(" Option ~~~~~~~~~~ 5 ");
home.setTitle(" Option ~~~~~~~~~~ 6 ");
//...
home.ModeToSet = home.chooseTitle() ;
cout<<"Selected Option: "<<home.ModeToSet;
}
Menu_Demo.mp4
- #include "iostream"
- #include "string"
- #include "windows.h"
- #include "cstdio"
- #include "vector"
MIT License
This program can cause unexpected behavior.
This program uses the WindowsAPI.
First option will have the return value 0 by default.