0

Below is my code to convert from decimal to binary:

```
#include "stdafx.h"
typedef struct tamNode
{
int Into;
struct tamNode *Next;
}Node;
typedef struct
{
Node *Head;
Node *Tail;
}List;
void createList(List &l)
{
l.Head = NULL;
l.Tail = NULL;
}
Node* createNode(int x)
{
Node *p;
p = new Node;
p->Into = x;
p->Next = NULL;
return p;
}
void addHead(List &l, Node *p)
{
if(l.Head == NULL)
{
l.Head = p;
l.Tail = p;
}
else
{
p->Next = l.Head;
l.Head = p;
}
}
void addTail(List &l, Node *p)
{
if(l.Head == NULL)
{
l.Head = p;
l.Tail = p;
}
else
{
l.Tail ->Next = p;
l.Tail = p;
}
}
void printList(List l)
{
Node *p;
p = l.Head;
while(p != NULL)
{
printf("%d", p->Into);
p = p ->Next;
}
}
void main()
{
List l1;
Node *p;
int x, sodu, i, n, k;
//char digit[6] = {'a','b','c','d','e','f'};
createList(l1);
printf("Enter the number of decimal:");
scanf("%d", &x);
while(x!=0)
{
sodu = x%2;
x = x/2;
p = createNode(sodu);
addHead(l1,p);
}
printf("\nThe number after converting from decimal to binary number:");
printList(l1);
}
```

But I do not know how to convert from decimal to hexadecimal? Please help me!

Thanks!!!