
问几道C++的题目,很急!求解答,回答好有加分!
1.Analyzethefollowingcode.intx=0;if(x>0);{cout<<"x";}Selectone:a.Nothingisprintedbeca...
1.Analyze the following code.
int x = 0;
if (x > 0);
{
cout << "x";
}
Select one:
a. Nothing is printedbecause x > 0 is false.
b. The symbol x isalways printed.
c. The value ofvariable x is always printed.
d. The symbol x isalways printed twice.
这个题目int x=0 是默认大于0吗?我测试发现好像是b选项。
2.What is 1 + 1 + 1 + 1 + 1 == 5?
Select one:
a. true
b. There is noguarantee that 1 + 1 + 1 + 1 + 1 == 5 is true.
c. false
求解答! 展开
int x = 0;
if (x > 0);
{
cout << "x";
}
Select one:
a. Nothing is printedbecause x > 0 is false.
b. The symbol x isalways printed.
c. The value ofvariable x is always printed.
d. The symbol x isalways printed twice.
这个题目int x=0 是默认大于0吗?我测试发现好像是b选项。
2.What is 1 + 1 + 1 + 1 + 1 == 5?
Select one:
a. true
b. There is noguarantee that 1 + 1 + 1 + 1 + 1 == 5 is true.
c. false
求解答! 展开
2个回答
展开全部
1、b
2、a
第一题:
int x = 0;
if (x > 0); //主要是要注意这里后面有个分号,所以下面的代码块并不受if()结果的限制
{
cout << "x";
}
更多追问追答
追问
第一题是这样,好吧
追答
第一题:
int x = 0;
if (x > 0); //主要是要注意这里后面有个分号,所以下面的代码块并不受if()结果的限制
{
cout << "x";
}
第二题:
换成浮点数也还是a,其实浮点数也不是那么容易出错的,不过浮点数一般不用==来判断。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询