Creative Commons License Foxbond's Repo

/** (c) 2015 Michał (Foxbond) Chraniuk */
#include <stdio.h>

typedef struct elem {
				char nazwisko[30];
				char imie[20];
				char nrPJ[10];
				char nrRS[10];
				struct elem* next;
}elem;
elem* db=NULL;
int count=0;


void addDriver (char* nazwisko, char* imie, char* nrPJ, char* nrRS){
		 
}

void delDriver (){
	   
}

void sortDrivers (char* field, char* order){
		 if (field == "nazwisko"){
		 		if (order == "asc"){
					 
 			  }else if (order == "desc"){
							
			  }
     }else if (field == "nrRS"){
		 		if (order == "asc"){
					 
 			  }else if (order == "desc"){
							
			  }	 
		 }
		 printf("\n---------------------\nNie zaimplementowano\n---------------------------\n");
}

void displayDrivers (){
		 if (db == NULL){
		 		printf("Pusta lista!");
		 		return;
     }
     
     elem* p = db;
     int i=1;
     for (;;){
		 		 printf("Kierowca nr %d:\n%s %s", i++, p->imie, p->nazwisko);
		 		 if (p->next == NULL){
				 		break;
			   }
			   p = p->next;
		 }
}

void cls(){
		 system("cls");		 
}

int main (){
		int size,i;
		char opt;
		
		printf("Ilu kierowcow zarejestrowac: ");
		scanf("%d", &size);
		
		do {
			 cls();
			 printf("Liczba wpisanych kierowcow: %d/%d\n1. Dodaj nowego kierowce\n2. Usun ostatniego kierowce\n0. Wyjscie", count, size);
			 opt = getch();
			 
			 if (opt == '1'){
			 		addDriver();
		   }else if (opt == '2'){
 			    delDriver();
			 }else if (opt == '0'){
		      cls();
			 		getch();
					return 0;
			 }
	 }while(count<size);
		
		cls();
		printf("Utowrzona lista:\n");
		displayDrivers();
		getch();
		cls();
		printf("Lista posortowana wg nazwisk rosnaco:\n");
		sortDrivers("nazwisko", "asc");
		displayDrivers();
		getch();
		cls();
		printf("Lista posortowana wg nr rejestracyjnych malejaco:\n");
		sortDrivers("nrRS", "desc");
		displayDrivers();
		getch();
		return 0;
}

> Back