填空题

[说明]
下面程序实现十进制向其他进制的转换。
[C++程序]
#include "iostream.h"
#include "math.h"
#include <conio.h>
typedef struct node
int data;
node *next;
Node;
class Transform

public :
void Trans (int d,int i) ; //d为数字;i为进制
void print () ;
private :
Node *top;

void Transform::Trans(int d,int i)

int m,n=0;
Node *p;
while (d>0)

(1) ;
d=d/i;
p=new Node;
if(!n)
p->data=m;
(2) ;
(3) ;
n++;

else
p->data=m;
(4) ;
(5) ;



void Transform: :print ()

Node *p;
while (top ! =NULL)

p=top;
if (p->data>9)
cout<<data+55 ;
else
cout<<data;
top=p->next ;
delete p;

【参考答案】

top=p
热门 试题

填空题
i++
填空题
perm(n-1,s1+1)