以下是在vc++6.0下运行的结果,我列举了输入345,进制分别为2,8,16的得出的结果,下面的不止只有这三个,输入任意进制的都可以
输入一个整数和进制数:345,2
转换成进制之后的数:101011001
Press any key to continue
输入一个整数和进制数:345,2
转换成进制之后的数:101011001
Press any key to continue
输入一个整数和进制数:345,16
转换成进制之后的数:159
Press any key to continue
程序如下:
#include<stdio.h>
#include<stdlib.h>
#define TRUE 1
#define FALSE 0
#define Stack_Size 100
typedef int StackElementType;
typedef struct
{
StackElementType elem[Stack_Size];
int top;
}SeqStack;
void InitStack(SeqStack *S)
{
S->top=-1;
}
热门文档