Only 1 testcase running:

code:

Your code is not producing correct answers, try following this approach,
void printspiral(node *root)
{
int h=height(root);
bool ltr=false;
for(int i=1;i<=h;i++)
{
printAtLevel(root,i,ltr);
ltr=!ltr;
}
}

and use a separate function for printAtLevel, where u can use this condition as,
if(level>1)
{
if(ltr)
{
printAtLevel(root->right,level-1,ltr);
printAtLevel(root->left,level-1,ltr);
}
else
{
printAtLevel(root->left,level-1,ltr);
printAtLevel(root->right,level-1,ltr);
}
}