假设intx=4,y=50,下列语句的循环体共执行几次()。while(y/x>3){if(y%x>3){x=x+1;}else{y=y/x;}}
A.1次
B.2次
C.3次
D.4次
A.1次
B.2次
C.3次
D.4次
A.2
B.4
C.6
D.8
A.2
B.4
C.6
D.8
设x和y均为int型变量,则以下for循环中的scanf语句最多可执行的次数是_____。
for (x=0,y=0;y!=123&&x<3;x++)
scanf ("%d",&y);
A、5
B、3
C、2
D、1
a=b a$amp; 注意:部分源程序已存在文件testl7_2.cpp中。
请勿修改主函数main和其他函数中的任何内容,仅在函数Compare的花括号中填写若干语句。
文件testl7_2.cpp的内容如下:
include<iostream.h>
include<stdlib.h>
class AA {
int *a;
int n;
int MS;
public:
void InitAA(int aa[], int nn, int ms)
{
if(nn>ms)
{
cout<<"Error!"<<end1;
exit(1);
}
MS=ms;
n=nn;
a=new int[MS];
for(int i=0; i<n; i++) a[i]=aa[i];
}
int Compare(AA b);
};
int AA::Compare(AA b)
{
}
void main()
{
AA a,b,c;
int x[]={1,2,3,4,5};
int y[]={1,2,3,6,7};
int z[]={1,2,5,7,9};
a. InitAA(x,3,5);
b. InitAA(y,3,5);
c. InitAA(z,3,5);
if (a.Compare(b))
cout<<"a=b"<<end1;
else
cout<<"a<>b"<<end1;
if (a.Compare(c))
cout<<"a=c"<<end1;
else
cout<<"a<>c"<<end1;
}
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!