作者ric2k1 (Ric)
看板EE_DSnP
标题Re: [问题] 有第一次作业的标准解答吗?
时间Sat Oct 6 12:44:09 2007
:
: 已上传至课程网页 ---
:
: http://cc.ee.ntu.edu.tw/~ric/teaching/ComputerProgramming/latest/Homework%20assignments.htm
:
: 助教是谁还不知道, 只好自己写... 有问题请多指教.
:
: --
:
※ 发信站: 批踢踢实业坊(ptt.cc)
: ◆ From: 59.121.130.193
: → ric2k1:感谢不能三日不见的高手提醒, 偷偷更新第三题的答案... 10/05 00:22
: 推 ilway25:我发现int a,,b;不对但int a,b,;对耶..上网找不到答案- - 10/05 00:56
: 推 ric2k1:的确, 不过这个太不正常了, 可以看看就好. 谢谢指正. 10/05 08:26
: 推 keyboardle:我在改作业时..发现{}加在main之前的绿色区都有error.. 10/06 11:50
: 推 ric2k1:哎呀, 写的太急了, 在main之前的绿色区域都不能加 {} 10/06 12:37
很抱歉, 第四题的答案在匆忙中写错了----
在main之前的绿色区域都不能加 {}, 只能加 ';'
不过目前 cc.ee.ntu.edu.tw 好像挂了, 等一下再将新版的解答上传.
=========
Just FYI. The orange region is the original green region before main()
=========
Adding a ';' is like a adding an empty (null) statement. So it can be
inserted at where a statement can be added.
Adding a "{}" is like declaring a scope. So it can be inserted at where
creating new scope makes sense.
So you can insert a ';' or "{}" in the "green" places, but will get a warning
in the "yellow" spot. You can insert a ';' in the orange area, but you cannot
insert a "{}" there. Compiler will issue an error if you insert them
somewhere else.
You may insert a ',' or "()" after <iostream> ("yellow region"), but you will
get a compilation warning. ',' cannot be inserted anywhere else.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.130.193
1F:→ ric2k1:已重新上传 10/06 13:08