C ++ primer 4th edition Reading Notes-Part I: the basics

Source: Internet
Author: User
Chapter 2. Variables and Basic Types

[2.1] beware: Float generally only guarantees 6 Valid digits, while double can ensure at least 10 digits. Therefore, double is better than float in ensuring computing accuracy.

Ex 2.3 34464 (warning c4305: "initialization": truncation from "Int" to "unsigned short. Actually 100000-65536)
Ex 2.4-31072 (100000-65536-65536)
Ex 2.9 which, if any, of the following are illegal? (C, d, e, f seems to be faulty)

(A) "who goes with f \ 145 rgus? \ 012 "(B) 3.14e1l (c)" two "L" some "(d) 1024f (e) 3.14ul (f)" multiple line comment









Ex 2.14 (a) int double = 3.14159; (B) Char _; (c) bool catch-22; (d) Char character or_2 = '1'; (e) float float = 3.14f; B and E are valid.




Ex 2.16 (a) int car = 1024, auto = 2048;
(B) int ival = ival; // correct (c) STD: CIN> int input_value; (d) double salary = wage = 9999.99; (e) double calc = calc ();

2.3.5 extern int I; // declares but does not define I, which is the role of extern.
Int I; // declares and defines I
Can be declaration multiple times, only one definition!


Chapter 3. Library types
Exercise 428-435 was not done.


Ex5.23 outputs 10 and 1.

Part I ends.















Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.