Example #1
0
int heuristicPathFinder(int source, int target)
{
    initialiseSearch();
    
    int distance = 0;
    int *outlist = getLinkedEdges(source);
    setVisit(source);
    printNode(source);
    
    
    while(inList(outlist, target) == FALSE && outlist[0] != 0)
    {
        distance++;
        int maxOut = largestOutDegreeSearch(outlist);
        setVisit(maxOut);
        printNode(maxOut);
        outlist = getLinkedEdges(maxOut);
    }//while
    
    distance++;
    printNode(target);
    return distance;
}//heuristicPathFinder
Example #2
0
int main(){
	day = month = year = -1;
	isLoged = 0;
	msgId = msgget(997,0666);
	if(msgId == -1){
		perror("utworzenie kolejki komunikatow");
	}
	pid = getpid();
	
	while(1){
		if(isLoged){
			printf("Zalogowano jako: %s\n", logedLogin);
		}
		printf("#1. Zarejestruj się\n");
		printf("#2. Zaloguj się\n");
		printf("#3. Umów się na wizyte\n");
		printf("#4. Edytuj wizyte\n");
		char choose;
		fgets(&choose,5,stdin);
		switch(choose){
			case '1': // dodanie pacjenta
			{
				sendPatientData();
				break;
			}
			case '2': // logowanie
			{
				login();
				break;
			}
			case '3': // umawianie wizyty
			{
				setVisit();
				break;
			}
			case '4': // umawianie wizyty
			{
				editVisit();
				break;
			}
		}
		sleep(1);
		day = year = month = -1;
	}
	return 0;
}