网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下而程序实现十进制向其他进制的转换。
[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) j
(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;
}
}
参考答案
更多 “ 下而程序实现十进制向其他进制的转换。[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) j(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:elsecout<<data;top=p->next;delete P;}} ” 相关考题
考题
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。[说明]下面程序实现十进制向其它进制的转换。[C++程序]include"ioStream.h"include"math.h"includetypedef struct node {int data;node*next;}Node;Class Transform.{DUDlic: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;elsecout<<data;top=p->next;delete p;}}
考题
以下程序的运行结果是______。 include include template class TA
以下程序的运行结果是______。include<iostream.h>include<math.h>template<class T>class TAdd//定义类模板TAdd,T为类型{Tx,y;public:TAdd (Ta,Tb) {x=a,y=b;) //构造函数Tadd() { retum x+y;}//成员函数};void main( ){TAdd<int>A (5,6);
考题
有以下程序,程序运行的结果是 ______。includeincludevoid main(){charx
有以下程序,程序运行的结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char x[]= "C++" ,y[10]= "C++" ; cout<<sizeof(x)/sizeof(char)<<“,”<<sizeof(y)/sizeof(char); }A.3 3B.4 4C.4 10D.10 10
考题
在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是A.#include <math.h>B.#include <stdio.h>C.#define <math.h>D.#define <stdio.h>
考题
在C程序中如果要使用数学函数,如sqrt(x),pow(x,y)等,需要在程序中加入的语句是______A.#define <math.h>B.#define <stdio.h>C.#include <stdio.h>D.#include <math.h>
考题
02610031:使用scanf函数时,在源程序开头()。A.书写#include <stdio.h>B.书写#include <math.h>C.不必写#includeD.书写#include <scanf.h>
考题
2、某源程序使用了STC单片机的相关寄存器,则应该使用()预定义。A.#include “intrins.h”B.#include “STC15Wxxx.h“C.#include “math.h”D.#include “stdio.h”
考题
程序填空,使下面程序实现输出N!(N<=10000)的十进制位数。 #include <stdio.h> #include <math.h> int main () { int i, n; double sum; sum = 0.0; scanf("%d", n); for (i = 2; i <= n; i++) { sum +=_________; } printf ("%dn", (int)ceil(sum)); return 0; }
考题
12、一个C语言源程序中如果调用了函数fabs,那必须有编译预处理命令()。A.#include <stdio.h>B.#include <math.h>C.#include <ctype.h>D.#include <stdlib.h>
热门标签
最新试卷