C + + PREMIER Second class post-title

Source: Internet
Author: User

2.7 Explains the differences between the following literal constants

(a) ' A ', l ' a ', ' a ', l ' a '
(b) 10u, 10L, 10uL, 012, 0xC
(c) 3.14, 3.14f, 3.14L

(1) ' A ' means that the character a;l ' a ' denotes a wide character literal; " A "represents the letter A and the null character of the two-character string; L" a "denotes wide character literals A and null characters.

(2) 10 is an integer type 10,10u is an unsigned 10,10l for a long shape 10,10ul is an unsigned long integer 10,012 is an octal 10,0xc of 16 binary 10.

(3) 3.14 for floating-point double precision 3.14,3.14f is a floating-point single-precision 3.14,3.14l of 3.14 of the floating-point extension precision.

2.8 Determines the type of the following literal constants:

(a) -10 (b) -10u (c)-10. (d) -10e-2

(a) int type, (b) unsigned int (c) double type (d) Double type

Note:-10. The following. Represents a decimal, so is the double type -10e-2 is the scientific notation, i.e.-0.1, so is the double type?

2.9 which (if any) of the following are illegal?

(a) "who goes with f\145rgus?\012"
(b) 3.14e1l

(c) "Some" and "L"
(d) 1024f (e) 3.14UL
(f) "Multiple line comment"

(a) and (d)

2.10 writes a program with an escape character, outputs 2M, and then wraps. Modify the program, Output 2, followed by a tab, then M, and finally the newline character.  

#include <iostream>int  main () {    "" << Std::endl;    GetChar ();     return 0 ;}

#include <iostream>int  main () {    "" <<  Std::endl;    GetChar ();     return 0 ;}

C + + PREMIER second-class title

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.