Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- #include "tree.h"
- float somaNotas(Arv *Tree){
- if(Tree == NULL){
- return 0;
- }else{
- return Tree->nota + somaNotas(Tree->left) + somaNotas(Tree->right);
- }
- }
- int main(){
- Arv *randons = abb_cria();
- randons = abb_insere(randons, 1, 0.0);
- randons = abb_insere(randons, 2, 2.3);
- randons = abb_insere(randons, 3, 9.2);
- randons = abb_insere(randons, 4, 10);
- randons = abb_insere(randons, 5, 5);
- randons = abb_insere(randons, 6, 6);
- printf("Soma das notas: %4.2f", somaNotas(randons));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement