1 00:00:01,280 --> 00:00:10,610 Each type will have a literal representation, so an integer will be numeric represented with a decimal 2 00:00:10,610 --> 00:00:11,390 point. 3 00:00:11,990 --> 00:00:19,550 If it is a signed integer, the literal can also use the plus or minus symbol to indicate the sign. 4 00:00:19,580 --> 00:00:26,690 Similarly, a real number can have a literal value that contains a decimal point, and you may even 5 00:00:26,690 --> 00:00:30,310 use the scientific format, including an exponent. 6 00:00:30,320 --> 00:00:38,000 So Cplusplus has a various rules to use when specifying literals in code, and these will be covered 7 00:00:38,000 --> 00:00:39,170 in next lecture, of course. 8 00:00:39,170 --> 00:00:42,330 So some examples in literals I will show you here. 9 00:00:42,350 --> 00:00:44,810 For example, let's create an integer named. 10 00:00:46,090 --> 00:00:53,920 Uh, POG here plus one, and then integer knock here. 11 00:00:54,910 --> 00:00:59,290 Uh, here, minus one and double here. 12 00:00:59,320 --> 00:01:00,730 Micro here. 13 00:01:01,750 --> 00:01:09,670 Uh, one E, six here, and double double unit here. 14 00:01:09,700 --> 00:01:11,970 Double unit here. 15 00:01:11,980 --> 00:01:13,450 One point here. 16 00:01:13,450 --> 00:01:20,440 Just the one point and STD string name here for example, Oxley. 17 00:01:21,670 --> 00:01:28,600 And note that the unit variable, the compiler knows that the literal is a real number because the value 18 00:01:28,630 --> 00:01:29,800 has a decimal point. 19 00:01:29,800 --> 00:01:36,640 So for integers you can provide a hexadecimal literal in your code by prefixing the number with zero 20 00:01:36,670 --> 00:01:50,360 x here for example integer the integer my hex here 0X1 hundred 0X1 hundred here. 21 00:01:51,100 --> 00:01:57,610 So this is an 256 in in decimal. 22 00:01:59,430 --> 00:02:00,440 The smell. 23 00:02:00,450 --> 00:02:01,050 Let's see. 24 00:02:01,050 --> 00:02:01,550 What? 25 00:02:01,560 --> 00:02:02,580 Zero x? 26 00:02:04,060 --> 00:02:04,780 Means here. 27 00:02:04,810 --> 00:02:05,800 Print f. 28 00:02:06,740 --> 00:02:08,330 Uh, decimal. 29 00:02:08,330 --> 00:02:11,510 So decimal point and my x. 30 00:02:11,540 --> 00:02:13,190 Let's see. 31 00:02:13,760 --> 00:02:17,660 As you can see here, 0X1 hundred. 32 00:02:17,660 --> 00:02:21,350 So it's a hexadecimal, uh, number type. 33 00:02:21,350 --> 00:02:30,590 And when you print this with the decimal format specifier, you will get 256 integer by integers here. 34 00:02:30,590 --> 00:02:33,890 So, so these, these are the integers of as well. 35 00:02:33,920 --> 00:02:37,460 Of course this is a different numbering system. 36 00:02:37,460 --> 00:02:38,540 So. 37 00:02:40,100 --> 00:02:45,680 By default, the output string will print the numeric values in base 11 as shown here. 38 00:02:45,680 --> 00:02:53,360 So however you can insert a manipulator into an output stream to tell it to use a different number base. 39 00:02:53,360 --> 00:02:58,520 So the different the default behavior is here. 40 00:02:58,660 --> 00:03:11,450 STD this here dec here, which means the numbers should be displayed as base ten and std std octal. 41 00:03:11,450 --> 00:03:24,030 So it's the octal means the display as a octal base base eight and this is decimal decimal base ten. 42 00:03:24,050 --> 00:03:25,310 Let's write it here. 43 00:03:25,340 --> 00:03:28,280 Octal base eight. 44 00:03:29,610 --> 00:03:30,990 And so. 45 00:03:32,520 --> 00:03:35,690 Um, what's next here? 46 00:03:35,700 --> 00:03:37,790 So we got the base 16 as well. 47 00:03:37,850 --> 00:03:38,070 Oops. 48 00:03:38,100 --> 00:03:38,770 I'm sorry. 49 00:03:39,740 --> 00:03:43,380 STD hex here, base 16. 50 00:03:43,380 --> 00:03:47,030 So this means display as a hexadecimal here. 51 00:03:47,580 --> 00:03:54,150 Uh, which means hexadecimal decimal base 16. 52 00:03:54,660 --> 00:03:57,510 Let's see here. 53 00:03:58,790 --> 00:03:59,120 Here. 54 00:04:00,290 --> 00:04:09,140 And if you prefer to see the prefix printed, check your check the use the string manipulator STD show 55 00:04:09,140 --> 00:04:11,840 base as shown here. 56 00:04:12,140 --> 00:04:13,160 STD Show. 57 00:04:13,160 --> 00:04:13,530 Base. 58 00:04:13,550 --> 00:04:14,680 Show base. 59 00:04:14,690 --> 00:04:15,260 Here. 60 00:04:15,470 --> 00:04:16,070 Like this. 61 00:04:16,070 --> 00:04:18,970 So Cplusplus defines some literals. 62 00:04:18,980 --> 00:04:21,410 So for bool the logic type. 63 00:04:21,410 --> 00:04:24,620 There are true and false constants here. 64 00:04:24,620 --> 00:04:30,830 Let's make this comment because we will not write any codes on it for now. 65 00:04:31,490 --> 00:04:35,860 So as you know, logic type is a true or false. 66 00:04:35,870 --> 00:04:39,320 So where false is zero and true is one. 67 00:04:39,320 --> 00:04:47,150 So there is also no constant again zero, which is used as invalid value for any pointer type.