VB icon

Customizable Menu Uses the arrow keys and return keys

Email
Submitted on: 1/2/2015 7:11:00 AM
By: theMayor (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: C++ (general)
Views: 487
 
     Need A Cool Menu? Here you go. You can change the text and highlight color in seconds. Though not commented very well it is easy to see what is happining. Made by a begginer for expert programs Please email me and tell me what you think!!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Customizable Menu Uses the arrow keys and return keys
// Description:Need A Cool Menu? Here you go. You can change the text and highlight color in seconds. Though not commented very well it is easy to see what is happining. Made by a begginer for expert programs
Please email me and tell me what you think!!
// By: theMayor (from psc cd)
//**************************************

#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
//**********************************************
int color=10;// Change the number to change the text color
int highlight=14; // Change the number to change the text color
int choice=8;
void options()
{
 system ("cls");
 if (choice==8)
 {
 cout << "You Chose New Game!!!\n";
 // your code goes here
 }
 else if (choice==9)
 {
cout << "You Chose To Highscores!!\n";
// your code goes here
 }
}
//*********************************************************************************************
//Do not edit Below This line
//*******************************************************************************************
void menu()
{
 textcolor(color);
 gotoxy(35,8);
 textbackground(0);
 if (choice==8)
 {
 textbackground(highlight);
 }
 cprintf("New Game");
 gotoxy(35,9);
 textbackground(0);
 if (choice==9)
 {
 textbackground(highlight);
 }
 cprintf ("High Scores");
 gotoxy(35,10);
 textbackground(0);
 if (choice==10)
 {
 textbackground(highlight);
 }
 cprintf ("Exit");
 cout <<endl;
}
int main()
{
 system ("cls");
 menu();
 char key;
 for (;;)
 {
 key=getch();
 if (key=='\r')
 {
 options();
 break;
 }
 switch (key)
 {
case 'H':
if (choice-1<8)
{
break;
}
else
{
choice--;
}
menu();
break;
case 'P':
if (choice+1>10)
{
break;
}
else
{
choice++;
}
menu();
break;
 }
 }
 return 0;
}


Other 6 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.