能否帮忙写一个C++程序将输入的数,转换成其他进制,并打印出来?

[复制链接]
查看11 | 回复3 | 2012-6-24 22:54:12 | 显示全部楼层 |阅读模式
以前用c语言写的,把头文件和相关语句改一下就是c++了。#include #include #define size 20typedef struct stack{int ele[size]; int top;}stack;void empty(stack *s)//初始化栈为空{s->top=-1;}void push(stack *s,int n)//入栈{if(s->top==size-1){printf("栈空间已满,无法入栈!"); exit(0); }s->ele[++s->top]=n;}int pop(stack *s)//出栈{ if(s->...
回复

使用道具 举报

千问 | 2012-6-24 22:54:12 | 显示全部楼层
//如下是采用C++风格写的由10进制--》16进制,转换成其他进制类似,#include "stdio.h"class ClassTrans{public:
void Trans() {
int x,i=0,y,j; char a[80]; scanf("%d",&x); y=x;...
回复

使用道具 举报

千问 | 2012-6-24 22:54:12 | 显示全部楼层
#includeusing namespace std;char digit[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";int fun(int num, int k, char d[]){static int count = 0;int n;if(num < ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行