Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/09/2015, 08:27
Avatar de ALVIA2010
ALVIA2010
 
Fecha de Ingreso: noviembre-2012
Mensajes: 26
Antigüedad: 11 años, 5 meses
Puntos: 3
Mensaje Menu de Opciones en c++

bueno..!! nesecito un poco de su ayuda esta vez.. Me dejaron de proyecto final.. hacer un juego de laberinto..!!
El cual ya lo desarrolle y funciona al maximo...
solo que hay un pequeño detalle..
al terminar el juego..! nesecito que me muestre un mensaje a los lados diciendo FELICIDADES.....!!
1.-desea volver a jugar ..?
2.- salir

esas opciones.. las incluyo pero de igual no me las agarra quizas ustedes puedan ayudarme .. les dejo el codigo acontinuacion...

Código:
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <time.h>
#include <windows.h>

 //DEFINIENDO LAS DIRECCIONES
#define UP 80
#define DOWN 72
#define RIGTH 77
#define LEFT 75




       int tecla;


     void DibujarLaberinto(int matriz[][44], int posicion[2]){

   for(int i=0; i<24; i++){
      for(int j=0; j<44; j++){
         if(i==posicion[0] && j==posicion[1]) cout <<(char)1 ;
         else if(matriz[i][j] == 1) cout <<(char)176;
         else if(matriz[i][j] == 2) cout <<(char)176;
         else if(matriz[i][j] == 3) cout <<(char)187;
         else if(matriz[i][j] == 4 ) cout <<(char)188;
         else if(matriz[i][j] == 0) cout<<" ";
          }
       cout << endl;
    }
   cout << endl;
}



void cargar_laberinto(){


char teclado;
    int matriz[24][44]={2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
                        1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,
                        1,0,0,0,2,2,2,2,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,2,2,2,2,0,0,0,0,1,0,0,2,2,2,2,2,0,0,0,0,1,
                        1,0,0,0,0,0,0,1,0,0,0,1,0,0,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,
                        1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,0,0,1,0,0,0,2,2,2,2,2,1,
                        1,2,2,2,2,0,0,1,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,
                        1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,2,2,0,0,0,1,0,0,0,0,1,
                        1,0,0,0,2,2,2,1,2,2,2,2,2,2,2,0,0,0,0,2,2,2,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,
                        1,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
                        1,0,0,0,1,0,0,1,0,0,1,0,0,2,2,2,2,2,2,1,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,1,0,2,2,2,1,
                        1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,
                        1,0,0,0,0,0,0,1,0,0,1,0,0,2,2,2,2,2,2,2,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,2,2,2,0,0,1,
                        1,2,2,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,
                        1,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,2,2,2,2,2,2,2,2,1,
                        1,0,0,0,2,2,2,2,2,2,2,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,
                        1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,2,2,2,2,0,0,0,1,
                        1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0,1,0,0,0,1,
                        1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,3,
                        1,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,4,
                        1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,2,2,2,2,1,0,0,2,2,2,2,1,0,0,2,2,2,1,0,0,0,1,0,0,1,2,2,2,1,
                        1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,2,2,2,0,0,1,0,0,0,1,
                        1,0,0,0,2,2,2,1,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,0,1,0,0,0,0,0,0,0,1,0,0,2,2,2,0,0,0,1,
                        1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,
                        2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};



    int posicion[2]={4,0};
     int opcion;

    DibujarLaberinto(matriz,posicion);


       while(posicion[0] != 17 || posicion[1] != 43){

         if(kbhit()){

        teclado = getch();
       switch(teclado){
          case LEFT:
             if(posicion[1]-1>=0 && matriz[posicion[0]][posicion[1]-1] != 1 && matriz[posicion[0]][posicion[1]-1] != 2) posicion[1] = posicion[1]-1;
             clrscr();
             DibujarLaberinto(matriz,posicion);
             break;
          case UP:
             if(posicion[0]+1<=23  && matriz[posicion[0]+1][posicion[1]] != 2 && matriz[posicion[0]+1][posicion[1]] != 1) posicion[0] = posicion[0]+1;
              clrscr();
             DibujarLaberinto(matriz,posicion);
             break;
          case RIGTH:
             if(posicion[1]+1<=43  && matriz[posicion[0]][posicion[1]+1] != 1 && matriz[posicion[0]][posicion[1]+1] != 2) posicion[1] = posicion[1]+1;
              clrscr();
             DibujarLaberinto(matriz,posicion);
             break;
          case DOWN:
             if(posicion[0]-1>=0  && matriz[posicion[0]-1][posicion[1]] != 2 && matriz[posicion[0]-1][posicion[1]] != 1) posicion[0] = posicion[0] - 1;
             clrscr();
             DibujarLaberinto(matriz,posicion);
             break;

             }  } }

            gotoxy(52,7);cout<<"FELICIDADES...!!";

             gotoxy(48,9);cout<<"1.-Recargar El juego..??"<<endl;

               }






         //COMIENZO DEL CUERPO DEL PROGRAMA MAIN

            int main(){

  textcolor(GREEN);
gotoxy(24,6); cprintf("UNIVERSIDAD TECNICA DE MANABI");
gotoxy(22,7); printf("-----------------------------------");
  textcolor(9);
gotoxy(29,9); cprintf("JUEGO DEL LABERINTO");
gotoxy(26,8); printf("PROYECTO DE PROGRAMACION");
 textcolor(5);
gotoxy(7,16); cprintf("INTEGRANTES");
gotoxy(7,17); printf("----------------");
gotoxy(7,18); printf(">>KEVIN ROLDAN");
gotoxy(7,19); printf(">>YADIRA PARRAGA");
 textcolor(5);
gotoxy(51,16); cprintf("PROFESOR");
gotoxy(48,17); printf("----------------");
gotoxy(48,18); printf(">>GABRIEL DE MERA ");
gotoxy(48,19); printf(">>PARALEO : 'B' ");
gotoxy(26,22); printf("<ENTER> Continuar....!!");




    getch();

 clrscr();


     cargar_laberinto();



    getch();


}

Última edición por ALVIA2010; 03/09/2015 a las 08:40