void MenuVotante::mostrarListasPresentadas(Eleccion *eleccion){ Lista *lista; bool confirmacion=false; do{ lista=this->elegirLista(eleccion); if(lista!=NULL){ confirmacion=confirmarVotacion(eleccion,lista); } }while((!confirmacion) && lista!=NULL); if (confirmacion){ cout<<"Voto Aceptado"<<endl; //Se regresa al menu Principal opciones(); }else if (lista==NULL) { mostrarMenuElecciones(); } }
int opciones(){ menu(); int op; scanf("%d",&op); while(getchar()!='\n'); if(op == 1){ ingresar_registro(); opciones(); return 0; }else if(op == 2){ ver_registro(); opciones(); return 0; } else if(op == 3) return 3; else if(op == 4) return 4; else if(op == 5) return 5; else return 0; };
/*Funcion menu Funcion que solicita al usuario que accion desea realizar en el programa Opcion 1 --> permite agregar amigos a su agenda de contactos Opcion 2 --> permite enviar mensaje a un amigo determinado Opcion 3 --> salir del programa */ void menu() { int opcion; printf("\n---- Menu ---\n"); printf("1. Agregar amigos\n"); printf("2. Enviar mensaje\n"); printf("3.Salir\n"); printf("\n"); printf("Ingrese la opcion deseada: "); scanf("%d",&opcion); // lee la opcion que el usuario ingreso y lo guarda en la variable opcion opciones(opcion); // se dirige a la funcion opciones }
void MenuVotante::mostrarMenuElecciones(){ Eleccion *eleccion; eleccion=this->elegirEleccion(); if(eleccion==NULL){ opciones(); }else{ mostrarListasPresentadas(eleccion); } }
void menu(){ int opcion; printf("---- Menu ---\n"); printf("1. Agregar amigos\n"); printf("2. Enviar mensaje\n"); printf("3.Salir\n"); printf("\n"); printf("Ingrese la opcion deseada: "); scanf("%d",&opcion); opciones(opcion); }
//Funcion que lee el dato ingresado por el usuario void opciones(int opc){ if(opc == 1) agregarAmigos(); if(opc ==2) printf("Ingreso a enviar mensajes \n"); if(opc ==3) exit(0); if(opc > 3){ printf("Ingreso una opcion incorrecta \n"); printf("Ingrese la opcion deseada: "); scanf("%d", &opc); opciones(opc); } }
/* Funcion opciones Determina que debe ser el programa segun el dato que ingreso el usuario Si ingresa 1 --> se dirige a la funcion agregarAmigos() Si ingresa 2 --> se dirige a la funcion enviarMensajes() Si ingresa 3 --> cierra el programa Si ingresa otra opcion --> Indica que ingreso una opcion incorrecta y le solicita la opcion de nuevo */ void opciones(int opc) { if(opc == 1) { agregarAmigos(); } if(opc ==2) enviarMensajes(); // se dirige a enviarMensajes() if(opc ==3) exit(0); // cierra el programa if(opc > 3) { printf("Ingreso una opcion incorrecta \n"); //Indica que ingreso una opcion incorrecta printf("Ingrese la opcion deseada: "); //Solicita de nuevo la opcion scanf("%d", &opc); //Lee la opcion que ingreso el usuario opciones(opc); // vuelve a llamar a la funcion opciones } }
int main() { system("COLOR F3"); int f=INICIO+3; char tecla; while(tecla!=27){ opciones(f); gotoxy(COLUMNA,f); tecla=getch(); Flechas(&tecla,&f); } getch(); return 0; }
void MenuVotante::mostrarMenuDatos(){ char opcion; bool opcion_elegida=false; do{ system("clear"); cout<<"***********************"<<endl; cout<<"Menu Datos Personales"<<endl<<endl; cout<<"C - Cambiar Clave "<<endl; cout<<"D - Cambiar Domicilio"<<endl<<endl; cout<<"V - Volver a Menu Principal"<<endl; cout<<"Elegir opcion: "; cin>>opcion; opcion =(char) toupper(opcion); opcion_elegida= opcion=='C' || opcion=='D' || opcion=='V'; } while(!opcion_elegida); switch (opcion){ case 'V': opciones(); break; case 'C': this->cambiarClave(); mostrarMenuDatos(); break; case 'D': this->cambiarDomicilio(); mostrarMenuDatos(); break; default: break; } }
int main(){ opciones(); return(0); };
MenuVotante::MenuVotante(Votante *votante) { this->votante=votante; opciones(); }
int main(int argc, char *argv[]) { int i, j, codigoLibro[MAXLIBROS], cantidadPrestamos[MAXLIBROS],cuenta_alta=0; char titulo[MAXLIBROS][80], autor[MAXLIBROS][50], prestado; int aux_codigoLibro, aux; int estadoLibro[MAXLIBROS],cantPrestamo=0; //ESTADOLIBRO: -1= no ingresado int codigoPrestado[MAXLIBROS]; //0= en alta char aux2[80]; //1= prestado long int dni[MAXLIBROS]; int opcion; long int aux_dni; for(i=0;i<MAXLIBROS;i++) { estadoLibro[i]=-1; } opcion=opciones(); while(opcion!=8) { switch(opcion) { case 1: cuenta_alta++; alta(MAXLIBROS, codigoLibro, titulo, autor, estadoLibro, cuenta_alta); break; case 2: printf("MODIFICAR LIBRO\n"); printf("\n"); printf("Ingrese codigo de libro a modificar\n"); scanf("%d",&aux_codigoLibro); fflush(stdin); while(existeCodigo(aux_codigoLibro, codigoLibro, MAXLIBROS)==0) { printf("\n"); printf("El codigo no existe, reingrese codigo\n"); scanf("%d",&aux_codigoLibro); } if(existeCodigo(aux_codigoLibro, codigoLibro, MAXLIBROS)==1) { printf("El codigo existe\n"); modifica(MAXLIBROS,aux_codigoLibro,codigoLibro,titulo,autor); } break; case 3: printf("BAJA LIBRO\n"); printf("\n"); printf("Ingrese codigo libro a bajar\n"); fflush(stdin); scanf("%d",&aux_codigoLibro); while(existeCodigo(aux_codigoLibro, codigoLibro, MAXLIBROS)==0) { printf("Codigo no encontrado, reingrese\n"); scanf("%d",&aux_codigoLibro); } for(i=1;i<MAXLIBROS-1;i++) { if(aux_codigoLibro==codigoLibro[i]) { codigoLibro[i]=0; strcpy(titulo[i]," "); strcpy(autor[i]," "); estadoLibro[i]=-1; } } printf("Codigo %d dado de baja correctamente\n",aux_codigoLibro); break; case 4: printf("PRESTAMO LIBRO\n"); printf("\n"); printf("Ingrese codigo de libro a prestar\n"); scanf("%d",&aux_codigoLibro); fflush(stdin); printf("Ingrese DNI de persona a prestar\n"); scanf("%d",&aux_dni); while(existeCodigo(aux_codigoLibro, codigoLibro, MAXLIBROS)==0) { printf("Codigo no encontrado, reingrese\n"); scanf("%d",&aux_codigoLibro); } prestamo(estadoLibro, aux_codigoLibro, codigoLibro, codigoPrestado, MAXLIBROS, aux_dni, dni); cantPrestamo++; break; case 5: printf("Devolucion\n"); printf("\n"); printf("Ingrese codigo de libro a devolver\n"); scanf("%d",&aux_codigoLibro); while(existeCodigo(aux_codigoLibro, codigoLibro, MAXLIBROS)==0) { printf("Codigo no encontrado, reingrese\n"); scanf("%d",&aux_codigoLibro);; } for(i=1;i<MAXLIBROS;i++) { if(aux_codigoLibro==codigoLibro[i]) { estadoLibro[i]=0; dni[i]=0; printf("Libro %d devuelto\n",codigoLibro[i]); break; } } break; case 6: printf("Informar\n"); for(i=1;i<MAXLIBROS-1;i++) { for(j=i+1;j<MAXLIBROS;j++) { if(codigoPrestado[i]<codigoPrestado[j]) { aux=codigoLibro[i]; codigoLibro[i]=codigoLibro[j]; codigoLibro[j]=aux; strcpy(aux2,titulo[i]); strcpy(titulo[i],titulo[j]); strcpy(titulo[j],aux2); strcpy(aux2,autor[i]); strcpy(autor[i],autor[j]); strcpy(autor[j],aux2); aux=estadoLibro[i]; estadoLibro[i]=estadoLibro[j]; estadoLibro[j]=aux; } } } if(codigoPrestado[1]>0) { printf("Los datos de el/los libros mas prestados son:\n Codigo: %d\t\t Titulo: %s\t\t Autor: %s\n",codigoLibro[1],titulo[1],autor[1]); for(i=2;i<MAXLIBROS;i++) { if(codigoPrestado[1] == codigoPrestado[i]) { printf("Codigo: %d\t\t Titulo %s\t\t Autor: %s\n",codigoPrestado[i],titulo[i],autor[i]); } break; } } else { printf("No se prestaron libros\n"); } printf("El total de los libros prestados son: %d\n",cantPrestamo); break; case 7: printf("Listar libros\n"); for(i=1;i<MAXLIBROS-1;i++) { for(j=i+1;j<MAXLIBROS;j++) { if(strcmp(titulo[i],titulo[j])==1) { strcpy(aux2,titulo[i]); strcpy(titulo[i],titulo[j]); strcpy(titulo[j],aux2); aux=codigoLibro[i]; codigoLibro[i]=codigoLibro[j]; codigoLibro[j]=aux; strcpy(aux2,autor[i]); strcpy(autor[i],autor[j]); strcpy(autor[j],aux2); aux=estadoLibro[i]; estadoLibro[i]=estadoLibro[j]; estadoLibro[j]=aux; } } } printf("\n"); printf("Titulos prestados: \n"); for(i=1;i<MAXLIBROS;i++) { if(estadoLibro[i]==1) { printf("%s\n",titulo[i]); } } printf("\n"); printf("Titulos en biblioteca:\n"); printf("\n"); for(i=1;i<MAXLIBROS;i++) { if(estadoLibro[i]==0) { printf("%s\n",titulo[i]); } } break; } opcion=opciones(); } system("PAUSE"); return 0; }
void main(){ int monitor=VGA, modo=VGAHI; int num[6], secuencia[3],correcto=-1; int c1,c2,c3,b,x,y,fig=-1,n_res=0,n_ok=0,nv_imagen=-1,n_cuadro=-1,op_menu=0,op_menu1=0,op_menu3=0; char *animal[9]={"imagen\\bear.bmp","imagen\\fish.bmp","imagen\\frog.bmp","imagen\\lamb.bmp","imagen\\tiger.bmp","imagen\\chipmunk.bmp","imagen\\donkey.bmp","imagen\\mouse.bmp","imagen\\rabbit.bmp"}; unsigned x_pos,y_pos,num_boton; char r='n',s='n'; initgraph(&monitor,&modo,"\BGI"); cleardevice(); iniciarRaton(); menuprincipal(); mostrarRaton(); do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); if(num_boton==1){ //Revisa en el area de que boton, se hizo click if(x_pos>500 && x_pos<550 && y_pos>170 && y_pos<190 ) op_menu=1; else if(x_pos>500 && x_pos<550 && y_pos>(170+40) && y_pos<(190+40) ) op_menu=2; else if(x_pos>500 && x_pos<550 && y_pos>(170+80) && y_pos<(190+80) ) op_menu=3; else if(x_pos>500 && x_pos<550 && y_pos>(170+120) && y_pos<(190+120)) op_menu=4; else if(x_pos>500 && x_pos<550 && y_pos>(170+160) && y_pos<(190+160)) op_menu=5; } switch(op_menu){ case 1:{ do{ s='n'; cleardevice(); ocultarRaton(); busqueda_animales(); mostrarRaton(); //Llenado de num[] con numeros sin repetir de las imagenes a utilizar randomize(); for(c1=0;c1<6;c1++){ num[c1]=rand()%9; c2=0; while(c2<c1){ //revisa desde num[0] hasta la posicion que se acaba de escoger if (num[c1]==num[c2]) c2=c1--; c2++; } } //despliegue de las 6 imagenes seleccionadas ocultarRaton(); c3=0; for(c1=17;c1<=249;c1+=116) for(c2=122;c2<=240;c2+=118) imagen(c1,c2,animal[num[c3++]]); mostrarRaton(); do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); if(num_boton==1){ //Revisa en el area de que dibujo, se hizo click if(x_pos> 17 && x_pos<133 && y_pos>122 && y_pos<238) op_menu1=1; else if(x_pos> 17 && x_pos<133 && y_pos>240 && y_pos<356) op_menu1=2; else if(x_pos>133 && x_pos<249 && y_pos>122 && y_pos<238) op_menu1=3; else if(x_pos>133 && x_pos<249 && y_pos>240 && y_pos<356) op_menu1=4; else if(x_pos>249 && x_pos<365 && y_pos>122 && y_pos<238) op_menu1=5; else if(x_pos>249 && x_pos<365 && y_pos>240 && y_pos<356) op_menu1=6; } //impresion de imagen clickada if(1<=op_menu1 && op_menu1<=6){ ocultarRaton(); setfillstyle(1,DARKGRAY); bar(getmaxx()*9/16+20,getmaxy()/4,getmaxx()-30,getmaxy()*3/4); rectangle(378,getmaxy()/4-1,610,getmaxy()*3/4+1); imagen(436,180,animal[num[op_menu1-1]]); rectangle(436,180,550,295); n_res=1; n_cuadro=op_menu1; fig=num[op_menu1-1]; settextstyle(TRIPLEX_FONT,HORIZ_DIR,3); setcolor(WHITE); outtextxy(383,120,"¨Cual es el nombre"); outtextxy(405,140,"de este animal?"); outtextxy(270,440,"opciones"); n_ok=0; mostrarRaton(); } // Revision de area textual clickada e impresion de nombre clickado + OK if(num_boton==1){ if(n_ok==1){ setfillstyle(SOLID_FILL,RED); bar(392,320,518,345); rectangle(392,320,518,345); setcolor(WHITE); } if(x_pos>61 && x_pos<164 && y_pos>382 && y_pos<408){ outtextxy(430,315,"Bear"); nv_imagen=1; n_ok=1; } else if(x_pos>164 && x_pos<267 && y_pos>382 && y_pos<408){ outtextxy(430,315,"Fish"); nv_imagen=2; n_ok=1; } else if(x_pos>267 && x_pos<373 && y_pos>382 && y_pos<408){ outtextxy(430,315,"Frog"); nv_imagen=3; n_ok=1; } else if(x_pos>373 && x_pos<479 && y_pos>382 && y_pos<408){ outtextxy(425,315,"Lamb"); nv_imagen=4; n_ok=1; } else if(x_pos>479 && x_pos<579 && y_pos>382 && y_pos<408){ outtextxy(430,315,"Tiger"); nv_imagen=5; n_ok=1; } else if(x_pos>61 && x_pos<190 && y_pos>410 && y_pos<438){ outtextxy(397,315,"Chipmunk"); nv_imagen=6; n_ok=1; } else if(x_pos>190 && x_pos<319 && y_pos>410 && y_pos<438){ outtextxy(420,315,"Donkey"); nv_imagen=7; n_ok=1; } else if(x_pos>319 && x_pos<448 && y_pos>410 && y_pos<438){ outtextxy(422,315,"Mouse"); nv_imagen=8; n_ok=1; } else if(x_pos>448 && x_pos<578 && y_pos>410 && y_pos<438){ outtextxy(422,315,"Rabbit"); nv_imagen=9; n_ok=1; } if(n_ok==1){ setcolor(BLUE); setfillstyle(SOLID_FILL,WHITE); bar(545,320,590,345); rectangle(545,320,590,345); outtextxy(550,315,"Ok"); } //salida con Ok if(n_ok==1 && n_cuadro>0 && x_pos>545 && x_pos<590 && y_pos>320 && y_pos<345) s='s'; } mostrarRaton(); op_menu1=0;//para que no vuelva a imprimir la imagen seleccionada n_res=0; }while(s!='s'); //mensaje ocultarRaton(); cleardevice(); setbkcolor(BLACK); if((nv_imagen-1)==fig) imagen(0,0,"imagen\\bien.bmp"); else //if((nv_imagen-1)!=fig) imagen(0,0,"imagen\\suerte.bmp"); //desea continuar? outtextxy(100,280,"¨ Deseas continuar ?"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,WHITE); bar(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10); rectangle(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10); outtextxy(getmaxx()/4+10,getmaxy()*3/4-33,"Si"); bar(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10); rectangle(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10); outtextxy(getmaxx()/4+70,getmaxy()*3/4-33,"No"); // Ver si presiono SI o NO para continuar do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); mostrarRaton(); if(num_boton==1){ if(getmaxx()/4 < x_pos && x_pos < getmaxx()/4+ 40 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10) n_res=1; else if(getmaxx()/4+60 < x_pos && x_pos < getmaxx()/4+100 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10) n_res=2; } }while(n_res!=1 && n_res!=2); }while(n_res==1); n_cuadro=-1; nv_imagen=-1; n_res=0; ocultarRaton(); cleardevice(); menuprincipal(); }break; case 2:{ do{ op_menu=0; n_res=0; ocultarRaton(); cleardevice(); secuencias_logicas(); figuras(secuencia); //tira una secuencia delay(1000); cleardevice(); ocultarRaton(); secuencias_logicas(); setfillstyle(1,YELLOW); setcolor(RED); bar(30 ,getmaxy()/4-6,getmaxx()/2+20,getmaxy()*3/4+19); rectangle(30-1,getmaxy()/4-7,getmaxx()/2+20,getmaxy()*3/4+20); correcto=opciones(secuencia); //tira opciones y retorna la fila de la secuencia correcta //Seleccion de opciones do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); mostrarRaton(); if(num_boton==1){ //Revisa en el area de que opcion, se hizo click if(x_pos> 95 && x_pos<315 && y_pos> 113 && y_pos< 195) op_menu=1; else if(x_pos> 95 && x_pos<315 && y_pos> 90+113 && y_pos< 90+195) op_menu=2; else if(x_pos> 95 && x_pos<315 && y_pos>2*90+113 && y_pos<2*90+195) op_menu=3; } }while(op_menu<1); //mensaje ocultarRaton(); cleardevice(); setbkcolor(BLACK); if(op_menu-1==correcto) imagen(0,0,"imagen\\bien.bmp"); else imagen(0,0,"imagen\\suerte.bmp"); //desea continuar? outtextxy(100,280,"¨ Deseas continuar ?"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,WHITE); bar(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10); rectangle(getmaxx()/4,getmaxy()*3/4-30,getmaxx()/4+40,getmaxy()*3/4-10); outtextxy(getmaxx()/4+10,getmaxy()*3/4-33,"Si"); bar(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10); rectangle(getmaxx()/4+60,getmaxy()*3/4-30,getmaxx()/4+100,getmaxy()*3/4-10); outtextxy(getmaxx()/4+70,getmaxy()*3/4-33,"No"); // Ver si presiono SI o NO para continuar do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); mostrarRaton(); if(num_boton==1){ if(getmaxx()/4 < x_pos && x_pos < getmaxx()/4+ 40 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10) n_res=1; else if(getmaxx()/4+60 < x_pos && x_pos < getmaxx()/4+100 && getmaxy()*3/4-30 < y_pos && y_pos < getmaxy()*3/4-10) n_res=2; } }while(n_res!=1 && n_res!=2); op_menu=-1; }while(n_res==1); n_res=0; ocultarRaton(); cleardevice(); menuprincipal(); }break; case 3:{ cleardevice(); ocultarRaton(); ordenar_cosas(); mostrarRaton(); do{ x_pos=posicionHorizontal(); y_pos=posicionVertical(); num_boton=botonPresionado(); if(num_boton==1 && x_pos>(getmaxx()/16+3) && x_pos<(getmaxx()*7/16-3) && y_pos>(getmaxy()*3/8+3) && y_pos<(getmaxy()/2-3)) op_menu3=1; if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+3) && y_pos<(getmaxy()/2-3)) op_menu3=2; if(num_boton==1 && x_pos>(getmaxx()/16+3) && x_pos<(getmaxx()*7/16-3) && y_pos>(getmaxy()*3/8+80+3) && y_pos<(getmaxy()/2+80-3)) op_menu3=3; if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+80+3) && y_pos<(getmaxy()/2+80-3)) op_menu3=4; if(num_boton==1 && x_pos>(getmaxx()/16+3) && x_pos<(getmaxx()*7/16-3) && y_pos>(getmaxy()*3/8+160+3) && y_pos<(getmaxy()/2+160-3)) op_menu3=5; if(num_boton==1 && x_pos>(getmaxx()*9/16+3-20) && x_pos<(getmaxx()*15/16-3-20) && y_pos>(getmaxy()*3/8+160+3) && y_pos<(getmaxy()/2+160-3)) op_menu3=6; switch(op_menu3){ case 1:{ }break; case 2:{ }break; case 3:{ }break; case 4:{ }break; case 5:{ }break; case 6:{ s='s'; }break; } mostrarRaton(); op_menu3=0; }while(s!='s'); ocultarRaton(); cleardevice(); menuprincipal(); }break; case 4:{}break; case 5:{r='s'; }break; } //Esto solo es para imicializar nuevamente todo s='g'; mostrarRaton(); op_menu=0;//Esto debe ir siempre, sino se me lupea en la misma opcion }while(r!='s'); closegraph(); }