Use the following code to answer the following questions: int id = 0; cout [< "ID: "; cin ]> id; if (id == 1) cout << "Janet"; else if (id == 2 || id == 3) cout << "Mark"; else if (id == 4) cout << "Jerry"; else cout << "Sue"; (1) The above code display ____when the id variable contains the number 2? (2) The above code display ____when the id variable contains the number 4? (3) The above code display ____when the id variable contains the number 3? (4) The above code display ____when the id variable contains the number 8
举一反三
- 有如下程序: #include<iostream> using namespace std; class Con char ID; public: Con():ID(’A)cout<<1; Con(char ID):ID(ID)cout<<2; Con(Con &c):ID(c.getID())cout<<3; char getID()constreturn ID; ; void show(Con c)cout<<c.getID(); int main() Con c1; show(c1); Con c2(’B’); show(c2); return 0; 执行上面程序的输出是( )。 A: 13A23A B: 23A13B C: 13A23B D: 13823A
- Analyze the following code: Code 1: int number = 45; bool even; if (number % 2 == 0) even = true; else even = false; Code 2: int number = 45; bool even = (number % 2 == 0); A: Code 1 has compile errors. B: Code 2 has compile errors. C: Both Code 1 and Code 2 have compile errors. D: Both Code 1 and Code 2 are correct, but Code 2 is better.
- 在下列查询条件中,可以使用索引的是( )。 A: id + 2 > 3 B: id > 3 - 2 C: id + 1 = 3 D: id = 3
- 已知 a = [1, 2, 3] 和 b = [1, 2, 4] ,那么 id(a[1])==id(b[1]) 的执行结果为 ___________ 。
- 智慧职教: 在同一点短路时 Id(2) =[填空(1)]Id(3)。