十六进制的转换不对while循环中的if语句有问题

为什么在十六进制的转换不对,就是输入31,却输出1A,A之后的B、C、D、E、F都不会进行输出,简单来说就是while循环中的if语句有问题,但是问题在哪,求解


#include
using namespace std;

#define OK 1
#define ERROR 0
#define OVERFLOW -2

typedef int Status;
typedef struct SNode {
    int data;
    struct SNode *next;
} SNode, *LinkStack;

Status InitStack(LinkStack &S) {
    S = NULL;
    return OK;
}
bool StackEmpty(LinkStack S) {
    if (!S)
        return true;
    return false;
}
Status Push(LinkStack &S, int e) {
    LinkStack p;
    p = new SNode;
    if (!p) {
        return OVERFLOW;
    }
    p->data = e;
    p->next = S;
    S = p;
    return OK;
}
Status Pop(LinkStack &S, int &e) {
    LinkStack p;
    if (!S)
        return ERROR;
    e = S->data;
    p = S;
    S = S->next;
    delete p;
    return OK;
}
//算法3.20 数制的转换(链栈实现)
void conversion(int N) {//对于任意一个非负十进制数,打印输出与其等值的八进制数
    int e;
    LinkStack S;
    InitStack(S); //初始化空栈S
    while (N) //当N非零时,循环
    {
        Push(S, N % 16); //把N与16求余得到的十六进制数压入栈S
        N = N / 16; //N更新为N与16的商
    }
    while (!StackEmpty(S)) //当栈S非空时,循环
    {
        Pop(S, e); //弹出栈顶元素e
        if(e<=9)
            cout<else if(e=10)
            cout<<"A";
        else if(e=11)
            cout<<"B";
        else if(e=12)
            cout<<"C";
        else if(e=13)
            cout<<"D";
        else if(e=14)
            cout<<"E";
        else if(e=15)
            cout<<"F";    
    }
}
int main() {//对于输入的任意一个非负十进制数,打印输出与其等值的十六进制数
    int n, e;
    cout << "输入一个非负十进制数:" << endl;
    cin >> n;

    conversion(n);
    return 0;
}



img

else if(e==10)这个判断地方都要用==来判断相等

代码写得太啰嗦,建议这么写!

if(e<=9)
            cout<<e;
else
    cout << (char()e - 10 + 'A');