It is not working because you have not properly iterated the tree. You have simply calculated the sum of the outer nodes of the tree, the inner nodes still have to be accounted for.
Hint: How is your print function displaying all nodes?
[output][int main()
{
int x;
bst tree;
int y;
cout<<"please enter a number "<<endl;
cin>>x;
int sum=0;
while(x>0)
{
y=x%10;
sum=sum+y;
x=x/10;
tree.add(y);
}
tree.print(tree.getroot());
cout<<endl;
cout<<"the max is "<<tree.max()<<endl;
cout<<"The min is "<<tree.min()<<endl;
cout<<"the sum is"<<sum<<endl;