Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/11/2011, 08:42
gorystyle
 
Fecha de Ingreso: enero-2011
Ubicación: Venezuela, Táchira
Mensajes: 96
Antigüedad: 14 años, 1 mes
Puntos: 10
Respuesta: como hacer un menu

Cita:
Iniciado por bufomimascota Ver Mensaje
resolvi mi pregunta y si a alguien el sirve dejo aqui el codigo

Código c:
Ver original
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<process.h>
  4.  
  5. void main()
  6. {
  7.  
  8.   int tecla, op=1,i;clrscr();
  9.    do{
  10.  
  11.   for(i=6;i<=9;i++)
  12.  
  13.   {
  14.    gotoxy(29,i);printf("|");
  15.    gotoxy(39,i);printf("|");
  16.  
  17.  
  18.   }
  19.  
  20.   do{
  21.  
  22.  
  23.   gotoxy(30,i);printf("opcion 1");
  24.   gotoxy(30,7);printf("opcion 2");
  25.   gotoxy(30,8);printf("opcion 3");
  26.   gotoxy(30,9);printf("salir");
  27.  
  28.  
  29.   switch(op)
  30.   {
  31.   case 1:
  32.       Gotoxy(30,6);cprintf("opcion 1");
  33.       textcolor(1);
  34.       textbackground(7);
  35.  
  36.       break;
  37.  
  38.    case 2:
  39.       Gotoxy(30,7);cprintf("opcion 2");
  40.       textcolor(1);
  41.       textbackground(2);
  42.  
  43.       break;
  44.  
  45.  
  46.     case 3:
  47.       Gotoxy(30,8);cprintf("opcion 3");
  48.       textcolor(1);
  49.       textbackground(2);
  50.  
  51.       break;
  52.  
  53.  
  54.      case 4:
  55.       Gotoxy(30,9);cprintf("salir 4");
  56.       textcolor(1);
  57.       textbackground(2);
  58.  
  59.       break;
  60.  
  61.      }
  62.  
  63.  
  64.    do{
  65.       tecla=getch();
  66.       }while(tecla!=72 && tecla!=80 && tecla!=13);
  67.  
  68.  
  69.       if(tecla==72)
  70.       {
  71.  
  72.        if(op>1)
  73.        {
  74.        op--;
  75.        }
  76.        }
  77.  
  78.  
  79.        if(tecla==80)
  80.       {
  81.  
  82.        if(op<4)
  83.        {
  84.        op++;
  85.        }
  86.        }
  87.  
  88.        }while(tecla!=13);
  89.     clrscr();
  90.  
  91.   switch(op)
  92.   {
  93.   case 1: Printf("--1--");getch();break;
  94.   case 2: Printf("--2--");getch();break;
  95.   case 3: Printf("--3--");getch();break;}clrscr();
  96.   }while(op!=4);
  97.   getch();
  98.   }

lo unico que no puedo lograr que funcione bien es el sombreado

lo malo de tu programa es que solo funcionara en builder ya que la libreria conio.h es propietaria de borland :( una lastima si se quiere usar en otros compiladores kjejeje