![](https://lstatic.shangxueba.com/jiandati/h5/images/m_q_title.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/logo2.png)
![执行下列方法method(),返回值为()。public int method {int num=6;if (num>8) return num;num=7](https://img2.soutiyun.com/shangxueba/askcard/2023-06/19/965/20230619102541153.jpg)
执行下列方法method(),返回值为()。public int method {int num=6;if (num>8) return num;num=7
执行下列方法method(),返回值为()。 public int method { int num=6; if (num>8) return num; num=7; }
A.编译出错
B.6
C.7
D.8
执行下列方法method(),返回值为()。 public int method { int num=6; if (num>8) return num; num=7; }
A.编译出错
B.6
C.7
D.8
A.11
B.12
C.21
D.22
include
void func(int n)
{ static int num=1);
num=num+n;printf("%d",num);
}
main()
{ funo(3);func(4);printf("n"); }
程序运行后的输出结果是()。
A.4 8
B.3 4
C.3 5
D.4 5
下列程序运行结果是 。 class test{ long x; static int num; public: test (long m=0) {x=m;} test operator++(); test operator++(int); void Show() { cout<<"the num is:> <<",x="<> < <endl; } }; test test::operator++() { ++x; num is: the answer"> 参考答案: <span style="color:rgb(255, 0, 0)">The num is: 1,x=1 The num is: 2,x=3 The num is: 3,x=3 The num is: 3,x=1</span>
2、下列程序运行结果是 。 #include <iostream.h> class A { long x; public: A(long m) {x=m;} void Show() { cout<<"count="<> <<",x="<> < <endl; } a& operator++(); operator++(int); static int count; }; a::operator++() { ++x; ,x="<<x<<endl; A temp(*this); x++; return temp; } int A::count=1; void main() { A a(1); a.operator++(1); a.operator++(); a.Show(); }<br/><p class=" count="<<count++<<" answer"> 参考答案: <span style="color:rgb(255, 0, 0)">count=1,x=1 count=2,x=3 count=3,x=3</span>
3、下列程序运行结果是 。 class sample{ int x , y ; public : sample( ) { x=y=0 ; } sample( int i , int j) {x=i ; y=j ; } void copy( sample &obj) { *this=obj ; } sample operator--( ) { x-- ; y-- ; return *this; } void print( ){ cout << x << " " << y<< " " ; } } ; void main( ) { sample c1(1 , 2) , c2 ; --c1; c1.print( ) ; c2.copy(c1) ; --c2; c2.print( ) ; }
A.字符串a的长度
B.字符串b的长度
C.字符串a和b的长度之差
D.字符串a和b的长度之和
include<iostream>
using namespace std;
int main()
{
int Bum=500;
int& ref=num;
ref+=100;
cout<<num<<end1;
return 0;
}
char name[20】;int num;
scanf("name=%S num=%d",name,&num);
当执行上述程序段,并从键盘输入:name=Lili mum=1001<回车>后,name的值为()。
A.Lili
B.name=Lili
C.Lili num=
D.name=Lili num=1001
A.10
B.0
C.19
D.编译出错
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!