电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

完整版C++编程思想答案其他章节请点击用户名找hinkinginC++VIP免费

完整版C++编程思想答案其他章节请点击用户名找hinkinginC++_第1页
1/14
完整版C++编程思想答案其他章节请点击用户名找hinkinginC++_第2页
2/14
完整版C++编程思想答案其他章节请点击用户名找hinkinginC++_第3页
3/14
[ Viewing Hints ] [ Book Home Page ] [ Free Newsletter ] [ Seminars ] [ Seminars on CD ROM ] [ Consulting ] Annotated Solution Guide Revision 1.0 for Thinking in C++, 2nd edition, Volume 1by Chuck Allison ? 2001 MindView, Inc. All Rights Reserved.[ Previous Chapter ] [ Table of Contents ] [ Next Chapter ] Chapter 88-1Create three constintvalues, then add them together to produce a value that determines the size of an array in an array definition. Try to compile the same code in C and see what happens (you can generally force your C++ compiler to run as a C compiler by using a command-line flag). (Left to the reader) 8-2Prove to yourself that the C and C++ compilers really do treat constants differently. Create a global const and use it in a global constant expression; then compile it under both C and C++. Solution://: S08:GlobalConst.cppconstint n = 100; constint m = n + 2; int main() { } ///:~While this is a legal C++ program, C doesn’ t allow expressions with const variables at the global level, so the above code will not compile in C. If you move the declaration of m inside of main( ), however, it works fine in C. But don’ t let this make you think that you can do this for array declarations. Exercise 1 shows that you cannot use a const variable as an array dimension in C under any circumstances. 8-3Create example const definitions for all the built-in types and their variants. Use these in expressions with other consts to make new constdefinitions. Make sure they compile successfully. (Left to the reader) 8-4Create a const definition in a header file, include that header file in two .cpp files, then compile those files and link them. You should not get any e...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

完整版C++编程思想答案其他章节请点击用户名找hinkinginC++

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部