填空题
阅读下面程序:
#include <iostream.h>
long fib(int n)
if (n>2)
return (fib(n-1)+fib(n-2));
else
return (2);
void main()
cout<<fib(3)<<endl;
则该程序的输出结果应该是______。
【参考答案】
D
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
在下面的程序的横线处填上适当的语句,使该程序的输出为12。 #include <iostream> using namespace std; class Base public: int a,b; Base(int i)a=i; ; class Derived: public Base int a; public: Derived(int x):Base(x),b(x+1) void show() ______; 输出基类数据成员a的值。 cout<<b<<endl; ; int main() Derived d(1); d.show(); return 0;
点击查看答案
填空题
表达式operator++(x,int)其可以表示为______。
点击查看答案
相关试题
请将下列类定义补充完整。 class Basepub...
下列函数的功能是判断字符串str是否对称,...
______允许用户为类定义一种模式,使...
用来派生新类的类称为______,而派生...