LDE e LSE t5prog

                Never    
C
       
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct lista{
	int num;
	struct lista *prox, *ant;
}L1;

L1 *inicio, *aux, *fim, *temp;


typedef struct lista{
	char nome[50];
	struct lista *prox2, *ant2;
}L2;

L2 *inicio2, *aux2, *fim2, *temp2;



void inserirnum(){
	int r;
	
	temp=(L1*)malloc(sizeof(L1*));
	do{
    	printf("Numero a inserir: ");
		scanf("%d",&temp->num);
	
    	if(inicio==NULL){
        	inicio=temp;
        	inicio->prox=inicio->ant=NULL;
    	}
    	
    	else{
    		
        	if(temp->num>inicio->num){
            	temp->prox=inicio;
            	inicio->ant=temp;
            	temp->ant=NULL;
            	inicio=temp;
        	}
        	
        	else{
        		
            	aux=inicio;
            	
            	while(temp->num < aux->num && aux->prox!=NULL){
                	aux=aux->prox;
        		}
        		
            	if(temp->num<aux->num){
                	aux->prox=temp;
                	temp->ant=aux;
                	temp->prox=NULL;
            	}
            	
            	else{
                	temp->prox=aux;
                	temp->ant=aux->ant;
                	aux->ant->prox=temp;
                	aux->ant=temp;
            	}
            	
        	}
        	
    	}
			
	}while(r==1);
}



void inserirnome(){
	int r;
	
	temp=(L1*)malloc(sizeof(L1*));
	do{
    	printf("Nome a inserir: ");
		do{
			gets(temp2->nome);
		}while(strlen(temp2->nome)==0);
	
    	if(inicio==NULL){
        	inicio=temp2;
        	inicio->prox=inicio->ant=NULL;
    	}
    	
    	else{
    		
        	if(temp2->num>inicio2->num){
            	temp2->prox2=inicio2;
            	inicio2->ant2=temp2;
            	temp2->ant2=NULL;
            	inicio2=temp2;
        	}
        	
        	else{
        		
            	aux2=inicio2;
            	
            	while(temp2->num < aux2->num && aux2->prox2!=NULL){
                	aux2=aux2->prox2;
        		}
        		
            	if(temp2->num < aux2->num){
                	aux2->prox2=temp;
                	temp2->ant2=aux2;
                	temp2->prox2=NULL;
            	}
            	
            	else{
                	temp2->prox2=aux2;
                	temp2->ant2=aux2->ant2;
                	aux2->ant2->prox2=temp2;
                	aux2->ant2=temp2;
            	}
            	
        	}
        	
    	}
			
	}while(r==1);
}



void   




int main() {
	
	
	return 0;
}

Raw Text