數條c++問題,請高手解答

peter022 2008-10-07 07:37:05
1.The following code multiplies an unsigned integer a by 9.
((a << 3) + a)
2.The following expression is always true, assuming a is an integer that has beenpreviously dened and initialized to 0.
(a = 3 - 4)
3.The following expression is always true (note that the operator < is left asso-ciative).
(1/3 < 1/2 < 1)
4.The following code outputs the number 5.
if(2 < 3) if(3 < 2); else cout << 5;
5.The following statements will give a compilation error.
int a = 0;
const int FACTOR = a++;
(對或錯?),(請加解釋)

6.Consider the following code:
int a = 1, b = 10;
int c = (a++) - (++b);
int d = (a++) + (++c);
b = ++d;
What are the values of the following variables after executing the above code?(請列出步驟及解釋)
a = 3
b =
...全文
123 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
peter022 2008-10-07
  • 打赏
  • 举报
回复
1.The following code multiplies an unsigned integer a by 9.
((a < < 3) + a)
2.The following expression is always true, assuming a is an integer that has beenpreviously de ned and initialized to 0.
(a = 3 - 4)
3.The following expression is always true (note that the operator < is left asso-ciative).
(1/3 < 1/2 < 1)
4.The following code outputs the number 5.
if(2 < 3) if(3 < 2); else cout < < 5;
5.The following statements will give a compilation error.
int a = 0;
const int FACTOR = a++;
(对或错?),(请加解释)

6.Consider the following code:
int a = 1, b = 10;
int c = (a++) - (++b);
int d = (a++) + (++c);
b = ++d;
What are the values of the following variables after executing the above code?(请列出步骤及解释)
a = 3
b =
cutebear2008 2008-10-07
  • 打赏
  • 举报
回复
你用 简体中文发表的话 我会考虑去看看!!!!!!!!!!!!!!!
  • 打赏
  • 举报
回复
繁体,加英文..真是..
htqx 2008-10-07
  • 打赏
  • 举报
回复

第一个在式子里面修改了变量自身。会有问题呢
qqwx_1986 2008-10-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 Chiyer 的回复:]
繁体+e文 = =b
[/Quote]
台湾的?
backway 2008-10-07
  • 打赏
  • 举报
回复
UP
baihacker 2008-10-07
  • 打赏
  • 举报
回复
楼主结贴率很低...米兴趣了.
星羽 2008-10-07
  • 打赏
  • 举报
回复
繁体+e文 = =b
ldming 2008-10-07
  • 打赏
  • 举报
回复
ding !!

65,210

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧