Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. int main(int argc, char* argv[])
  2. {
  3. if( argc != 2 )
  4. {
  5. printf("Nie dodales pliku z głebokosciami");
  6. return 5;
  7. }
  8. char* fp = argv[1];
  9. int** tab = NULL;
  10. if( !Create(&tab, N, M) )
  11. {
  12. printf("nie udało sie zrobic tablicy");
  13. return 3;
  14. }
  15. int** path = NULL;
  16. if( !Create(&path, N, M) )
  17. {
  18. printf("nie udało sie zrobic tablicy");
  19. return 3;
  20. }
  21.  
  22. SetTab(fp, tab, N, M);
  23. #ifdef _DEBUG_
  24. Print(tab, N, M);
  25. printf("\n\n");
  26.  
  27. #endif _DEBUG_
  28.  
  29.  
  30. int portX = N - 1; //cel podrozy statkiem xd
  31. int portY = M - 1;//destination <3
  32. if( !root(tab, N, M, tab[0][0], 0, 0, path, portX, portY) )
  33. {
  34. printf("** Nie ma mozliwosci doplynac do portu!!\n\n");
  35. return 23;
  36. }
  37. printf("Nasza sciezka wyglada tak:\n");
  38. for( int i = 0; i < N; i++ )
  39. {
  40. for( int j = 0; j < M; j++ )
  41. printf("%d ", path[i][j]);
  42. printf("\n");
  43. }
  44. Delete( &tab, N);
  45. Delete( &path, N);
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement