#include <iostream>
#include <string>
#include "MyStack.hpp"
#define BINARY 2
#define OCTAlk 8
#define HEXADECIMAL 16
using namespace std;
int main(void){
char num[] = "0123456789ABCDEF";
MyStack<int> *pStack = new MyStack<int>(30);
int N = 2017;
int remainder = 0;
while(N != 0){
remainder = N % HEXADECIMAL;
pStack->push(remainder);
N = N / HEXADECIMAL;
}
while(!pStack->stackEmpty()){
int elem = 0;
pStack->pop(elem);
cout << num[elem];
}
cout << endl;
delete pStack;
pStack = NULL;
}
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦