Only built-in types exist in C + +, and there is no class-type literal value.
For example: 0 is the literal value of type int, and 3.14159 is a type literal of double.
Many types of literal literals
integer floating-point literals //decimal decimal 024 &NBSP ; // octal octal 0x14 &NBSP ; // hexadecimal hex 128u, 128U //&nbs P; unsigned1024ul // unsigned long1l // long Long plastic 8Lu & nbsp // unsigned long3.14159f = 3.14159e0f &nb sp;//float , scientific count. 001f = 1e-3f //float, scientific count 12.345L = 1.2345e1l //long double extended precision , Science counts 0. = 0e0 //Double, scientific count ' a '//char character l ' a ' //wch ar_t &Nbsp; wide characters//no literal constants for short
string LiteralsString literals are a string of constant characters, string literal constants are enclosed in double quotation marks, and character literal constants are enclosed in single quotation marks. In order to be compatible with the C language, string literals in C + + will be automatically added by the compiler to an empty string at the end.: ' A ': Represents a single character a "a": a string representing a character A and a null character two characters similarly there is a wide string L "a wide string literal": A string of wide characters + wide-empty character strings literal connection
different types of strings cannot be concatenated: string literals and wide string literals cannot be concatenatedStd::cout << "a multi-line" "string literal" "using concatenation" << Std::endl: A multi-line string literal using concatenation but std::cout << "multi-line" & Nbsp; l " Literal "<<std::endl; will compile the error. In addition, there is one more line literal: Std::cout <<" A multi-line \string literal \using concatenation "& lt;< Std::endl; note that "\" must be at the end of the line, followed by No comments or spaces ------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------
Literal literals in C + + specify a type