填空题

下面程序的输出结果是〈u〉 【9】〈/u〉。 #include 〈iostream〉 using namespace std; void f(int x) { if(x) { cout.put(’0’+x%10); f(x/10); } } int main() { f(11001); return 0; }

【参考答案】

10011
<上一题 目录 下一题>
热门 试题

填空题
以下程序实现栈的入栈和出栈的操作。其中有两个类:一个是节点类node,它包含点值和指向上一个节点的指针 prev;另一个类是栈类 stack, 它包含栈的头指针 top。生成的链式栈如下图所示。〈IMG onClick=over(this) title=放大 src= tp jsj 2jc++j28.1.gif 〉下面是实现程序,请填空完成此程序。#include 〈iostream〉using namespace std;class stack;class node{int data;node *prev;public:node(int d, node *n){data=d;prev=n;}friend class stack;};class stack{node *top; 栈头public:stack(){top=0;}void push(int i){node *n=〈u〉 【13】 〈 u〉;top=n;}int pop(){node *t=top;if (top){top=top-〉prev;int c= t-〉data;delete t;return c;}return 0;}int main (){stack s;s.push(6);s.push(3);s.push (1);return 0;}
填空题
有一种特殊的虚函数,重定义时不要求同名,这种虚函数是 【11】 。
相关试题
  • 若有以下程序:#include〈iostream〉using...
  • cout是I/O流库预定义的 【12】 。
  • 在下面的程序的横线处填上适当的语句,使该...
  • 以下程序调用findmax()函数返回数组中的...