Advertisement
Guest User

Untitled

a guest
May 25th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include "barnes.h"
  4.  
  5. void print_albero(nodo_t * root){
  6.     //nodo_t new_root=*root;
  7.     printf("Nodo Interno\n");
  8.     printf("X: %f\n", (*root).x);
  9.     printf("Y: %f\n", (*root).y);
  10.     printf("M: %f\n", (*root).massa);
  11.  
  12.     nodo_t * p_NE = root->NE;
  13.     nodo_t * p_NW = root->NW;
  14.     nodo_t * p_SE = root->SE;
  15.     nodo_t * p_SW = root->SW;
  16.  
  17.     if(p_NE!=NULL) {
  18.         printf("Albero NE\n");
  19.         printf("X: %f\n", (*p_NE).x);
  20.         printf("Y: %f\n", (*p_NE).y);
  21.         printf("M: %f\n", (*p_NE).massa);
  22.         // print_albero(root->NE);
  23.     };
  24.     if(p_NW!=NULL) {
  25.         printf("Albero NW\n");
  26.         printf("X: %f\n", (*p_NW).x);
  27.         printf("Y: %f\n", (*p_NW).y);
  28.         printf("M: %f\n", (*p_NW).massa);
  29.     };
  30.     if(p_SE!=NULL) {
  31.         printf("Albero SE\n");
  32.         printf("X: %f\n", (*p_SE).x);
  33.         printf("Y: %f\n", (*p_SE).y);
  34.         printf("M: %f\n", (*p_SE).massa);
  35.     };
  36.     if(p_SW!=NULL) {
  37.         printf("Albero SW\n");
  38.         printf("X: %f\n", (*p_SW).x);
  39.         printf("Y: %f\n", (*p_SW).y);
  40.         printf("M: %f\n", (*p_SW).massa);
  41.     };
  42.  
  43. }
  44.  
  45. int main(int argc, char *argv[]){
  46.     //STRINGA A CORPO
  47.     double x=0,y=0,m=0;
  48.     const char* stringa = "400 -600 1980";
  49.     stringa_a_corpo(stringa, &x, &y, &m);
  50.     printf("X: %f\nY: %f\nM: %f\n", x,y,m);
  51.  
  52.     //INSERISCI
  53.     nodo_t * p_albero_modificato;
  54.     _s=10000;
  55.  
  56.     nodo_t albero_vuoto={42,52,0,NULL,NULL,NULL,NULL};
  57.  
  58.     p_albero_modificato = inserisci(800,-20,-35,&albero_vuoto);
  59.  
  60.     nodo_t albero_modificato=*p_albero_modificato;
  61.    
  62.     // printf("%f\n", albero_modificato.x);
  63.     // printf("%f\n", albero_modificato.y);
  64.     // printf("%f\n", albero_modificato.massa);
  65.  
  66.     // nodo_t * NE=albero_modificato.NE;
  67.     // print_albero(NE);
  68.  
  69.     print_albero(&albero_modificato);
  70.  
  71. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement