Each type will have a literal representation, so an integer will be numeric represented with a decimal
point.
If it is a signed integer, the literal can also use the plus or minus symbol to indicate the sign.
Similarly, a real number can have a literal value that contains a decimal point, and you may even
use the scientific format, including an exponent.
So Cplusplus has a various rules to use when specifying literals in code, and these will be covered
in next lecture, of course.
So some examples in literals I will show you here.
For example, let's create an integer named.
Uh, POG here plus one, and then integer knock here.
Uh, here, minus one and double here.
Micro here.
Uh, one E, six here, and double double unit here.
Double unit here.
One point here.
Just the one point and STD string name here for example, Oxley.
And note that the unit variable, the compiler knows that the literal is a real number because the value
has a decimal point.
So for integers you can provide a hexadecimal literal in your code by prefixing the number with zero
x here for example integer the integer my hex here 0X1 hundred 0X1 hundred here.
So this is an 256 in in decimal.
The smell.
Let's see.
What?
Zero x?
Means here.
Print f.
Uh, decimal.
So decimal point and my x.
Let's see.
As you can see here, 0X1 hundred.
So it's a hexadecimal, uh, number type.
And when you print this with the decimal format specifier, you will get 256 integer by integers here.
So, so these, these are the integers of as well.
Of course this is a different numbering system.
So.
By default, the output string will print the numeric values in base 11 as shown here.
So however you can insert a manipulator into an output stream to tell it to use a different number base.
So the different the default behavior is here.
STD this here dec here, which means the numbers should be displayed as base ten and std std octal.
So it's the octal means the display as a octal base base eight and this is decimal decimal base ten.
Let's write it here.
Octal base eight.
And so.
Um, what's next here?
So we got the base 16 as well.
Oops.
I'm sorry.
STD hex here, base 16.
So this means display as a hexadecimal here.
Uh, which means hexadecimal decimal base 16.
Let's see here.
Here.
And if you prefer to see the prefix printed, check your check the use the string manipulator STD show
base as shown here.
STD Show.
Base.
Show base.
Here.
Like this.
So Cplusplus defines some literals.
So for bool the logic type.
There are true and false constants here.
Let's make this comment because we will not write any codes on it for now.
So as you know, logic type is a true or false.
So where false is zero and true is one.
So there is also no constant again zero, which is used as invalid value for any pointer type.