lunes, 16 de julio de 2012

ALGORITMO DEL PROGRAMA COTIDIANO


Algoritmo del programa con fila “PROBLEMA COTIDIANO”

1.- INICIO
2.- Declarar variable nombrec, nombret, ntaxi y destino
3.- Inicio FUNCION ACOLAR
4.- struct cola*nuevo;
5.- Introducir datos “numero de taxi, nombre del taxista, nombre del cliente y destino”
6.- nuevo->sig=NULL;
           if(princ==NULL)
             princ=nuevo;
              fin=nuevo;
                   else
                     fin->sig=nuevo;
                         fin=nuevo;
                             j++;
 7.- FIN FUNCION ACOLAR
8.- Inicio  FUNCION MOSTRAR
9.- struct cola *aux;
              aux=princ;
                  if(aux==NULL){
            Imprimir "COLA VACIA"
                               else       
                                      while(aux!=NULL)
10.- IMPRIMIR  “Numero de taxi, nombre del taxista, nombre del cliente, destino”
                aux=aux->sig;
11.- FIN FUNCION MOSTRAR
12.- Inicio FUNCION DESACOLAR
13.- struct cola *aux;
                  struct cola *aux1;
                         int cont;
                 aux=princ;
                aux1=princ;
                                  cont=0;
           while(aux!=NULL)
                if(aux->ntaxi==aux1->ntaxi)
                    if(cont==0)
                          princ=princ->sig;
              aux=aux->sig;
              aux1=aux;
              cont=1;
 14.- FIN FUNCION DESACOLAR
15.- Inicio CUERPO PRINCIPAL
16.- int opc;
           Do
          Imprimir “REGISTRO DE PERSONAS ***SITIO DE TAXIS TULTITLAN”
          Imprimir “1. INGRESAR DATOS A LA COLA    2. MOSTRAR DATOS DE LA COLA  3. RETIRAR
                                                                                                                 DATOS EN LA COLA    4. SALIR”
17.- switch (opc)
           case 1:
            acolar();
              break;
                    case 2:
                       mostrar();
                               break;
                    case 3:
                        desacolar();
                                break;
                     default:
18.- Imprimir  "SALIR DEL SISTEMA"
                                 break;
                     while(opc!=4);

No hay comentarios:

Publicar un comentario