Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/11/2011, 13:10
bufomimascota
 
Fecha de Ingreso: septiembre-2011
Mensajes: 25
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: como hacer un menu

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