c++ primer Exercise 5.0
来源:互联网 发布:三星高通9008端口救砖 编辑:程序博客网 时间:2024/06/05 09:55
Exercise5.11: What are th values of i and after the each assignments.
int i; doubl d;
d = i = 3.5; // compile warning. i = 3, d = 3
i = d = 3.5; //compile warding d =3.5, i =3
Exercise 5.12: Explain what happens in each of the if tests:
if ( 42 = i )
if(i = 42 )
Exercise 5.13: The following assignments is illeage
double dval; int ival; int *pi;
dval = ival = pi =0;
Exercise 5.14: Altough the following are legal, they probably do not behave as the programmer expects, why? Rewrite the exressions as you think they should be
(a) if(ptr = retrieve_pointer() != 0)
)b) if(ival = 1024)
(c) ival + = ival +1;
Exercise 5.15: Explain the difference between prefix and postfix increment
Exercise 5.16: Why do you tink c++ wasn't named ++C?
Exercise 5.17: What whould happen if the while loop that prints the contents of a vector used the prefix incrment operator?
Exercise 5.18: Write a program that defines a vector of pointers to strings. Read the vector. printing each string and its corresponding size.
Exercise 5.19: Assuming that iter is a vector<string>::iterator, indicate which, if any, of the following expressions is legal. Explain the behavior of the legal exprssions.
(a) *iter++;
(b) (*iter) ++
(c) *iter.empty()
(d) iter->empty()
(e) ++ *iter; (f) iter++->empty()
Exercise 5.20. Writ a program to prompt the user for a pair of numbers and report which is smaller.
Exercise 5.21, write a program to process the elemtns of a vector<int>. Replace each element with an odd value by twice that value
- c++ primer Exercise 5.0
- C++primer 5th exercise section 12.1.6 答案
- C++ Primer Exercise 5.18
- C primer plus(5th edit) program exercise 7-6(统计ei occurs)
- C++ Primer, 5th Edition Exercise CH1
- C++ Primer, 5th Edition Exercise CH2
- C程序设计语言 Exercise 2-9
- C程序设计语言 Exercise 2-10
- C程序设计语言 Exercise 3-1
- C++primer
- 《C++primer》
- C++primer
- C++primer
- C++Primer
- C++ primer English fourth edition exercise page 301
- C++ primer English Fourth edition P322 Exercise 9.18
- Solution for Exercise 4.33 of C++ Primer 5th Edition.
- Exercise
- hdu 4292 Food (最大流)
- 使用WebRTC搭建前端视频聊天室-04——点对点通信篇
- UE4制作插件的插件神器pluginCreator
- 分布式程序防止多用户对同一数据更新问题
- POJ 2253 Frogger (dijkstra)
- c++ primer Exercise 5.0
- 内部类
- 反射invoke方法之我见
- 九度oj 1017
- 美轮美奂宇宙星空制作神器Spacescape
- UVa 10913 - Walking on a Grid(dp递推变形)
- Android Studio——Gradle 版本回退
- (一〇二)静态库(.a)的打包
- 20150802-集合