Capturas:
Codigo:
#include#include #include #include int menu(); void ocultar(); int aleatorio(); int ingresar(); int main() { int w=2; while(w!=0) { w=menu(); switch(w) { case 1:{ocultar();}break; } } } void gotoxy(int xpos, int ypos)//Funcion de Posicionamiento { COORD scrn; HANDLE hOuput = GetStdHandle(STD_OUTPUT_HANDLE); scrn.X = xpos; scrn.Y = ypos; SetConsoleCursorPosition(hOuput,scrn); } int menu() { int q,i; do{ system("cls"); system("color F1"); gotoxy(11,8); for(i=9;i<25;i++) { printf("%c",177); } gotoxy(11,13); for(i=9;i<25;i++) { printf("%c",177); } gotoxy(11,15); printf("ingrese un numero:"); gotoxy(10,10); printf("\t1.jugar\n\ \t0.salir\n"); gotoxy(11,16); scanf("%d",&q); fflush(stdin); }while(q<0&&q>2); return q; } void ocultar() { int i,j,aciertos=0,errores=0,x1,y1; char ran,z[10][10]; char oculta[10][10]={{219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219}, {219,219,219,219,219,219,219,219,219,219},}; for(i=0;i<10;i++) { for(j=0;j<10;j++) { z[i][j]=aleatorio(); } } do{ ran=rand()%(1-31)+1; }while(ran==7||ran==8||ran==9||ran==10||ran==13); while(aciertos<100) { system("cls"); system("color F1"); printf("\ndebe en contrar a:%c Y procure no encontrar el chacal:%c\n\n",ran,2); printf("\t 0 1 2 3 4 5 6 7 8 9\n\n"); for(i=0;i<10;i++) { printf("\t%d ",i); for(j=0;j<10;j++) { printf("%c ",oculta[i][j]); } printf("\n\n"); } x1=ingresar(); y1=ingresar(); for(i=0;i<10;i++) { for(j=0;j<10;j++) { if(z[i][j]==z[x1][y1]) { oculta[i][j]=z[x1][y1]; aciertos++; } } printf("\n"); } if(oculta[x1][y1]==ran) { system("cls"); system("color F0"); printf("\n\n!!!!!!BIEN HECHO EN CONTRO A EL: %c !!!!!\n\n\n",ran); printf("\t 0 1 2 3 4 5 6 7 8 9\n\n"); for(i=0;i<10;i++) { printf("\t%d ",i); for(j=0;j<10;j++) { printf("%c ",z[i][j]); } printf("\n\n"); } aciertos=aciertos+100; } else { if(oculta[x1][y1]==2) { system("cls"); system("color 0F"); printf("\n!!!!PERDIO!!!\n"); printf("ENCONTRO EL CHACAL..... %c\n\n\n",2); printf("\t 0 1 2 3 4 5 6 7 8 9\n\n"); for(i=0;i<10;i++) { printf("\t%d ",i); for(j=0;j<10;j++) { printf("%c ",z[i][j]); } printf("\n\n"); } aciertos=aciertos+100; } } } system("pause"); } int ingresar() { int q=10; do{ printf("ingrese la coordenada: "); scanf("%d",&q); fflush(stdin); }while(q<0||q>9); return q; } int aleatorio() { char i; do{ i=rand()%(1-31)+1; }while(i==7||i==8||i==9||i==10||i==13); return i; }
descarga el codigo fuente desde aqui.
No hay comentarios :
Publicar un comentario