Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "barnes.h"
- void print_albero(nodo_t * root){
- //nodo_t new_root=*root;
- printf("Nodo Interno\n");
- printf("X: %f\n", (*root).x);
- printf("Y: %f\n", (*root).y);
- printf("M: %f\n", (*root).massa);
- nodo_t * p_NE = root->NE;
- nodo_t * p_NW = root->NW;
- nodo_t * p_SE = root->SE;
- nodo_t * p_SW = root->SW;
- if(p_NE!=NULL) {
- printf("Albero NE\n");
- printf("X: %f\n", (*p_NE).x);
- printf("Y: %f\n", (*p_NE).y);
- printf("M: %f\n", (*p_NE).massa);
- // print_albero(root->NE);
- };
- if(p_NW!=NULL) {
- printf("Albero NW\n");
- printf("X: %f\n", (*p_NW).x);
- printf("Y: %f\n", (*p_NW).y);
- printf("M: %f\n", (*p_NW).massa);
- };
- if(p_SE!=NULL) {
- printf("Albero SE\n");
- printf("X: %f\n", (*p_SE).x);
- printf("Y: %f\n", (*p_SE).y);
- printf("M: %f\n", (*p_SE).massa);
- };
- if(p_SW!=NULL) {
- printf("Albero SW\n");
- printf("X: %f\n", (*p_SW).x);
- printf("Y: %f\n", (*p_SW).y);
- printf("M: %f\n", (*p_SW).massa);
- };
- }
- int main(int argc, char *argv[]){
- //STRINGA A CORPO
- double x=0,y=0,m=0;
- const char* stringa = "400 -600 1980";
- stringa_a_corpo(stringa, &x, &y, &m);
- printf("X: %f\nY: %f\nM: %f\n", x,y,m);
- //INSERISCI
- nodo_t * p_albero_modificato;
- _s=10000;
- nodo_t albero_vuoto={42,52,0,NULL,NULL,NULL,NULL};
- p_albero_modificato = inserisci(800,-20,-35,&albero_vuoto);
- nodo_t albero_modificato=*p_albero_modificato;
- // printf("%f\n", albero_modificato.x);
- // printf("%f\n", albero_modificato.y);
- // printf("%f\n", albero_modificato.massa);
- // nodo_t * NE=albero_modificato.NE;
- // print_albero(NE);
- print_albero(&albero_modificato);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement