Advertisement
2002VB Miscellaneous #25056

Customizable Menu Uses the arrow keys and return keys

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!!

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#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;
}
Original Comments (3)
Recovered from Wayback Machine