Beispiel #1
0
int main()
{
	// Test 2. Read stations in from bloor_line.txt


	struct station *kipling = read_stations();
	print_stations(kipling);
	/* should print:
		The stations: 
				 Kipling (0)-> Islington     
		      Kipling -> Islington (0)-> RoyalYork     
		    Islington -> RoyalYork (0)-> OldMill       
		    RoyalYork -> OldMill (0)-> Jane          
		      OldMill -> Jane (0)-> Runnymede     
			 Jane -> Runnymede (0)-> HighPark      
		    Runnymede -> HighPark (0)-> Keele         
		     HighPark -> Keele (0)-> DundasWest    
			Keele -> DundasWest (0)-> Lansdowne     
		   DundasWest -> Lansdowne (0)-> Dufferin      
		    Lansdowne -> Dufferin (0)-> Ossington     
		     Dufferin -> Ossington (0)-> Christie      
		    Ossington -> Christie (0)-> Bathurst      
		     Christie -> Bathurst (0)-> Spadina       
		     Bathurst -> Spadina (0)-> StGeorge      
		      Spadina -> StGeorge (0)-> Bay           
		     StGeorge -> Bay (0)-> Yonge         
			  Bay -> Yonge (0)-> Sherbourne    
			Yonge -> Sherbourne (0)-> CastleFrank   
		   Sherbourne -> CastleFrank (0)-> Broadview     
		  CastleFrank -> Broadview (0)-> Chester       
		    Broadview -> Chester (0)-> Pape          
		      Chester -> Pape (0)-> Donlands      
			 Pape -> Donlands (0)-> Greenwood     
		     Donlands -> Greenwood (0)-> Coxwell       
		    Greenwood -> Coxwell (0)-> Woodbine      
		      Coxwell -> Woodbine (0)-> MainStreet    
		     Woodbine -> MainStreet (0)-> VictioriaPark 
		   MainStreet -> VictioriaPark (0)-> Warden        
		VictioriaPark -> Warden (0)-> Kennedy       
		       Warden -> Kennedy (0)
	*/
	// Test 8. Remove all stations
	printf("\n\nCREATION COMPLETE\n\n");
	//remove_all_stations(&kipling); 
	print_stations(kipling); // prints only "The stations:"
	
	printf("\n\nCONCLUDE DEALLOCATION\n");

	return 0;
}
Beispiel #2
0
//printf in asce order
void print_stations(int **l,int ln,int n)
{
	if(n<=0)
		return;
	print_stations(l,l[ln][n-1],n-1);
	printf("line %d,station %d\n",ln+1,n);
}
Beispiel #3
0
int main()
{
	int a1[]={7,9,3,4,8,4};
    int a2[]={8,5,6,4,5,7};	
	int *a[2];
	a[0]=&a1[0];
	a[1]=&a2[0];
	int t1[]={2,3,1,3,4};
	int t2[]={2,1,2,2,1};
	int *t[2];
	t[0]=&t1[0];
	t[1]=&t2[0];
	int e[]={2,4};
	int x[]={3,2};
	Result result;
	result=fastest_way(a,t,e,x,6);
	printf("the result is %d\n",result.fn);
	printf("the result ln is %d\n",result.ln);
	print_stations(result.l,result.ln,6);
}
Beispiel #4
0
int main()
{
    fast_way();
    print_stations();
    return 0;
}