填空题

以下程序的执行结果是 【11】 。
#include<iostream.h>
#include<stdlib.h>
class Sample public:
int x,y;
Sample()x=y=0;
Sample(int a,int b) x=a;y=b;
void disp()

cout<<"x="<<x<<",y="<<y<<end1;

;
void main()
Sample s1(2,3);
s1.disp();

【参考答案】

x=B,y=C
<上一题 目录 下一题>
热门 试题

填空题
阅读下面程序:#include <iostream.h>long fib(int n)if (n>2)return (fib(n-1) + fib(n-2));elsereturn (2);void main()cout<<fib(3)<<end1;则该程序的输出结果应该是 【12】 。
填空题
下列函数的功能是判断字符串str是否对称,对称则返回true,否则返回false。请在横线处填上适当内容,实现该函数。bool fun(char *str) int i=0,j=0; while(str[j]) j++; for(i--;i<j && str[i]==str[j]; i++, j--); return i 【10】 j;
相关试题
  • 在下面的程序的横线处填上适当的语句,使该...
  • 【14】 允许用户为类定义一种模式,使得...
  • 请将下列类定义补充完整。class Base pub...
  • 重新定义标识符的作用域规定是外层变量被隐...
  • 阅读下面程序:#include <iostream.h>...