WEBVTT 1 00:00:23.950 --> 00:00:25.450 Hello, this is Juhwan Kim 2 00:00:25.450 --> 00:00:29.000 This is the second lecture of Unreal C++ basics 3 00:00:29.000 --> 00:00:34.000 In this lecture, we will learn C++ grammar 4 00:00:34.000 --> 00:00:39.800 We will get to know of C++'s data type, variables, and functions' meanings 5 00:00:39.800 --> 00:00:42.600 and I will explain them 6 00:00:42.600 --> 00:00:47.450 I will let you know how to interpret and use 7 00:00:47.450 --> 00:00:49.700 conditionals, iterations, and expressions 8 00:00:50.001 --> 00:00:52.995 Meaning of function in C++ 9 00:00:54.450 --> 00:00:55.800 First, data type and variables 10 00:00:55.800 --> 00:00:58.800 Data type 11 00:00:58.800 --> 00:01:01.900 is the form for storing data 12 00:01:01.900 --> 00:01:05.500 Data is not refined 13 00:01:05.700 --> 00:01:07.350 The difference between data and information is 14 00:01:07.350 --> 00:01:10.500 whether it has a meaning or not 15 00:01:10.500 --> 00:01:14.000 Data type differs in size or expression method 16 00:01:14.000 --> 00:01:19.650 according to the type needed to put data in computer memory 17 00:01:19.950 --> 00:01:23.500 For example, there are types that can store integers 18 00:01:23.500 --> 00:01:25.650 floating points 19 00:01:25.650 --> 00:01:29.150 like decimals or fractions 20 00:01:29.150 --> 00:01:32.500 characters or strings 21 00:01:32.500 --> 00:01:37.600 boolean, enumerated, and void types 22 00:01:37.600 --> 00:01:42.450 Let me tell you about variables that can store various types like these 23 00:01:42.450 --> 00:01:45.300 As you can see in the table, there are various data types 24 00:01:45.300 --> 00:01:50.700 but the basic one is 'int' 25 00:01:50.700 --> 00:01:52.700 which stands for integer 26 00:01:52.701 --> 00:01:55.551 The content can vary 27 00:01:55.551 --> 00:01:58.850 but usually int has the size of 4 bytes 28 00:01:58.850 --> 00:02:03.900 It can express from -2.1 billion to 2.1 billion 29 00:02:03.900 --> 00:02:07.800 Unsigned int means int without a sign 30 00:02:07.800 --> 00:02:11.350 Since it does not have a sign, we ignore the negative numbers 31 00:02:11.351 --> 00:02:13.658 and it can express up to 4.2 billion 32 00:02:13.658 --> 00:02:19.858 Like this, there are short, unsigend short, long, unsinged long, float 33 00:02:19.858 --> 00:02:23.550 double, character, unsigned character data types 34 00:02:23.550 --> 00:02:27.500 Unlike int type that can only express integers 35 00:02:27.500 --> 00:02:31.250 float and double, which are real number types, are engineering expressions 36 00:02:31.250 --> 00:02:37.450 and it can express from 3.4*10^-38 37 00:02:37.450 --> 00:02:42.601 to 3.4*10^38 38 00:02:43.000 --> 00:02:45.500 When we talk about data type and variables 39 00:02:45.501 --> 00:02:49.018 you can consider variables as the bowl 40 00:02:49.018 --> 00:02:52.000 to put values expressed as the forementioned data types 41 00:02:52.000 --> 00:02:56.000 To put it easier, when you put a value into a bowl 42 00:02:56.000 --> 00:02:59.700 whether that be an integer, real number 43 00:02:59.700 --> 00:03:02.400 or a string 44 00:03:02.400 --> 00:03:04.750 it can become the integer 3 45 00:03:04.750 --> 00:03:07.400 real number 3.0 46 00:03:07.400 --> 00:03:10.250 or the string of 3 47 00:03:10.250 --> 00:03:11.600 the way that is desired 48 00:03:11.600 --> 00:03:14.650 So it is declared and defined based on the data type 49 00:03:14.650 --> 00:03:17.500 Now I'll tell you about declaration and definition of variables 50 00:03:17.500 --> 00:03:19.850 It is about grammars 51 00:03:19.850 --> 00:03:21.400 first the data type comes 52 00:03:21.400 --> 00:03:23.550 and then the variable name 53 00:03:23.550 --> 00:03:27.501 then an equal sign, and finally the value 54 00:03:27.501 --> 00:03:30.450 You also have to put a semicolon at the end 55 00:03:30.450 --> 00:03:34.000 For example, when you say int a = 3 56 00:03:34.000 --> 00:03:39.700 It means that in the variable named a with the data type of int 57 00:03:39.700 --> 00:03:44.450 the integer 3 is contained 58 00:03:44.450 --> 00:03:48.300 The next one says float fValue = 1.0f 59 00:03:48.300 --> 00:03:49.800 and this means 60 00:03:49.800 --> 00:03:54.000 it is in the form of a floating point 61 00:03:54.000 --> 00:03:57.650 In the variable named fValue 62 00:03:57.650 --> 00:04:00.750 with the data type of float, floating point 63 00:04:00.750 --> 00:04:04.850 the constant value 1.0f is contained 64 00:04:04.850 --> 00:04:07.600 The reason why there's an f at the end 65 00:04:07.601 --> 00:04:10.796 is to show that it's in a float type 66 00:04:11.000 --> 00:04:14.850 that is, a floating point type 67 00:04:14.850 --> 00:04:18.050 The next one says char c 68 00:04:18.051 --> 00:04:21.551 This means that the variable c in the form of a string 69 00:04:22.000 --> 00:04:24.900 is declared but not yet defined 70 00:04:24.900 --> 00:04:28.000 There is no value substituted so it is not defined 71 00:04:28.000 --> 00:04:32.700 and it is just declared that the variable character c will be used 72 00:04:32.700 --> 00:04:35.450 I explained briefly about data type and variables 73 00:04:35.451 --> 00:04:37.950 and next I'll talk about functions 74 00:04:37.950 --> 00:04:40.750 Functions are 75 00:04:40.750 --> 00:04:43.450 fundamentally the same with functions in maths 76 00:04:43.450 --> 00:04:46.500 In mathematics, they must be one-to-one 77 00:04:46.500 --> 00:04:48.550 and if there's an input there must be an output 78 00:04:48.550 --> 00:04:52.450 but in functions in programming, there does not need to be outputs 79 00:04:52.450 --> 00:04:59.000 So I'll tell you about return value which is the output, reference, and the mechanism 80 00:04:59.000 --> 00:05:03.800 To put it simply, function in programming is function in mathematics 81 00:05:03.800 --> 00:05:06.250 expanded in various forms 82 00:05:06.250 --> 00:05:10.000 In another way 83 00:05:10.000 --> 00:05:15.000 it is a defined element that can perform a function independently 84 00:05:15.000 --> 00:05:19.650 and a group of functions are called module 85 00:05:19.650 --> 00:05:23.600 And this function unit is at the core of structured programming 86 00:05:23.600 --> 00:05:27.000 Depending on programming languages, function names differ 87 00:05:27.000 --> 00:05:30.000 but function is the most basic form 88 00:05:30.000 --> 00:05:32.400 and sometimes it is called sub-routine 89 00:05:32.400 --> 00:05:36.450 Sub-routine means the same thing as function 90 00:05:37.030 --> 00:05:40.031 but it stresses that it diverges from the normal routine 91 00:05:40.031 --> 00:05:42.581 and comes back after performing 92 00:05:43.200 --> 00:05:44.900 It is also called method 93 00:05:44.900 --> 00:05:51.150 Method is used in languages like Java or C# that emphasize object orientation very much 94 00:05:51.150 --> 00:05:53.000 From the word function 95 00:05:53.000 --> 00:05:56.000 and expanding on the meaning of performing a function 96 00:05:56.000 --> 00:06:00.000 they use the word method meaning that it is about the methodology of it 97 00:06:00.550 --> 00:06:02.150 It is also called procedure 98 00:06:02.150 --> 00:06:07.900 Procedure is used to emphasize the server or the process 99 00:06:07.900 --> 00:06:11.550 saying that it performs something orderly 100 00:06:11.550 --> 00:06:15.300 Now we'll talk about the shape of the definition of functions 101 00:06:15.300 --> 00:06:18.650 There is int which is similar to variables 102 00:06:18.650 --> 00:06:21.000 and that is the type int 103 00:06:21.450 --> 00:06:24.350 which is a return type that I'll explain later 104 00:06:24.350 --> 00:06:26.750 int, space 105 00:06:26.750 --> 00:06:30.000 Add indicates the name of the function 106 00:06:30.100 --> 00:06:33.450 It is the name, and then parenthesis 107 00:06:33.450 --> 00:06:35.500 int A and int B 108 00:06:35.500 --> 00:06:39.150 These are the parameters of the function 109 00:06:39.150 --> 00:06:41.250 It is also called parameter(in Korean) 110 00:06:41.250 --> 00:06:43.000 which is the input of the function 111 00:06:43.000 --> 00:06:45.600 int on the left 112 00:06:45.600 --> 00:06:49.300 is the output data type 113 00:06:49.300 --> 00:06:51.300 and int a and int b on the right 114 00:06:51.301 --> 00:06:53.851 are parameters, which are the inputs 115 00:06:54.000 --> 00:06:57.000 Under that, there are curly brackets 116 00:06:57.000 --> 00:07:00.600 which indicate the body of the function 117 00:07:00.600 --> 00:07:05.400 The two slashes and the part that says function implementation 118 00:07:05.400 --> 00:07:09.300 is called the annotation which in programming 119 00:07:09.300 --> 00:07:13.250 is complied and does not have a meaning but that explains 120 00:07:13.250 --> 00:07:15.600 Then it says return a plus b 121 00:07:15.600 --> 00:07:19.550 To give you a brief explanation about this int a Add function 122 00:07:19.550 --> 00:07:22.000 it is a function receiving integers A and B 123 00:07:22.000 --> 00:07:25.650 and returning a plus b, the sum 124 00:07:25.650 --> 00:07:28.550 Let me give you an example of function definition order 125 00:07:28.550 --> 00:07:31.850 On the left, it says int main 126 00:07:31.850 --> 00:07:34.950 and void function 1, void function 2, void function 3 127 00:07:34.950 --> 00:07:37.350 3 functions are there 128 00:07:37.350 --> 00:07:42.650 It is a diagram showing the name of the function and its body 129 00:07:42.650 --> 00:07:45.000 Starting from int main 130 00:07:45.000 --> 00:07:49.350 it defines functions 1, 2, and 3 131 00:07:49.350 --> 00:07:51.400 Function definition 132 00:07:51.400 --> 00:07:56.750 puts a value into the parameter of a function and gets a return value after performing 133 00:07:56.750 --> 00:07:59.400 The int main in the example 134 00:07:59.400 --> 00:08:01.800 usually means the main function 135 00:08:01.800 --> 00:08:05.450 that performs in a console project 136 00:08:05.500 --> 00:08:07.600 and the main function is called the entry point 137 00:08:07.600 --> 00:08:09.000 When you run a program 138 00:08:09.000 --> 00:08:12.450 it will perform one by one starting from 139 00:08:12.450 --> 00:08:14.000 under the curly bracket under int main 140 00:08:14.000 --> 00:08:17.000 So it meets function 1 141 00:08:17.000 --> 00:08:19.350 meeting function 1 parenthesis 142 00:08:19.350 --> 00:08:22.250 it defines the first function, function 1 143 00:08:22.250 --> 00:08:24.000 Then the implementation flows 144 00:08:24.000 --> 00:08:26.900 to the void function 1 145 00:08:26.900 --> 00:08:29.900 on the top middle source 146 00:08:29.900 --> 00:08:31.600 Performs the function 147 00:08:31.600 --> 00:08:33.000 and when it meets return 148 00:08:33.000 --> 00:08:37.300 it comes back to function 1 on the left 149 00:08:37.300 --> 00:08:39.650 The process goes on 150 00:08:39.650 --> 00:08:41.500 and upon meeting function 2 151 00:08:41.500 --> 00:08:43.000 it goes to the bottom middle 152 00:08:43.000 --> 00:08:46.050 where void function 2 body is 153 00:08:46.050 --> 00:08:47.000 and again performs 154 00:08:47.000 --> 00:08:50.000 void function 2 155 00:08:50.000 --> 00:08:51.000 and the next step 156 00:08:51.000 --> 00:08:54.000 is where it meets the void function 3 definition 157 00:08:54.000 --> 00:08:57.550 Then void function 2 158 00:08:57.550 --> 00:08:59.700 defines function 3 159 00:08:59.700 --> 00:09:01.000 moving to void function 3 160 00:09:01.000 --> 00:09:04.500 on the right 161 00:09:04.500 --> 00:09:06.000 performing the function 162 00:09:06.000 --> 00:09:07.850 and coming back 163 00:09:07.850 --> 00:09:10.400 to void function 2 upon meeting the return 164 00:09:10.400 --> 00:09:14.000 Then again it meets return 165 00:09:14.000 --> 00:09:16.000 going back to the main function 166 00:09:16.000 --> 00:09:19.600 and performing what comes after the void function 3 parentheses 167 00:09:19.600 --> 00:09:23.800 The process can be shown with arrows 168 00:09:23.800 --> 00:09:26.050 Let me give you a bit more explanation 169 00:09:26.050 --> 00:09:27.850 on parameter that I mentioned before 170 00:09:27.850 --> 00:09:29.000 It is about 171 00:09:29.000 --> 00:09:31.750 ind Add function that I showed you 172 00:09:31.750 --> 00:09:34.650 Parameter is the part that indicates 173 00:09:34.650 --> 00:09:37.950 input in functions of mathematics 174 00:09:37.950 --> 00:09:41.700 When you have a function that adds two integers 175 00:09:41.700 --> 00:09:43.900 since you have to put two integers in 176 00:09:43.900 --> 00:09:45.950 you need to know how 177 00:09:45.950 --> 00:09:47.800 the two integers will be portrayed 178 00:09:47.800 --> 00:09:50.800 What's red here, that is 179 00:09:50.800 --> 00:09:55.000 int a and int b are the parameters 180 00:09:55.000 --> 00:09:56.750 If parameters are there like that 181 00:09:56.750 --> 00:09:58.550 from the part that uses the function 182 00:09:58.550 --> 00:10:00.650 we can put values in 183 00:10:00.650 --> 00:10:02.400 which are called arguments 184 00:10:02.400 --> 00:10:06.000 So, where it says int a and int b 185 00:10:06.000 --> 00:10:08.600 3 and 6 are put in 186 00:10:08.600 --> 00:10:11.800 3 is int a 187 00:10:11.800 --> 00:10:14.400 and 6 is int b 188 00:10:14.400 --> 00:10:16.400 So upon return 189 00:10:16.400 --> 00:10:19.200 We saw that it would return a plus b 190 00:10:19.200 --> 00:10:20.750 So on return 191 00:10:20.750 --> 00:10:23.000 we have the variable c 192 00:10:23.000 --> 00:10:25.750 c becomes return type 193 00:10:25.750 --> 00:10:27.400 or return value 194 00:10:27.400 --> 00:10:29.300 When I was first explaining the function 195 00:10:29.300 --> 00:10:31.450 int Add 196 00:10:31.450 --> 00:10:34.300 The int type at the very front of the function's name 197 00:10:34.300 --> 00:10:36.300 is the return type of the function 198 00:10:36.300 --> 00:10:38.000 The calculation will be done 199 00:10:38.000 --> 00:10:41.000 and it is returned in that int type 200 00:10:41.000 --> 00:10:43.000 In this case, it is 3 plus 6 201 00:10:43.000 --> 00:10:44.500 so 9 will be returned 202 00:10:44.500 --> 00:10:47.900 Return type and parameter type are together 203 00:10:47.900 --> 00:10:50.200 called function signature 204 00:10:50.200 --> 00:10:52.900 These are what have the function's 205 00:10:52.900 --> 00:10:57.050 form as signatures 206 00:10:57.050 --> 00:10:58.500 We didn't learn it yet 207 00:10:58.500 --> 00:11:01.700 but when you learn Lambda function or Delegate 208 00:11:01.700 --> 00:11:04.350 you will get to know about function signature 209 00:11:04.350 --> 00:11:06.250 To give a brief explanation, function signature is 210 00:11:06.250 --> 00:11:10.500 a grammar that expressed what function it is 211 00:11:10.550 --> 00:11:12.550 What you should note is that 212 00:11:12.550 --> 00:11:15.450 parameter, argument, signature and such 213 00:11:15.450 --> 00:11:16.700 are translated to 214 00:11:16.700 --> 00:11:18.900 formal parameter, actual parameter 215 00:11:18.900 --> 00:11:21.200 formal argument, actual argument, function signature 216 00:11:21.200 --> 00:11:22.750 and such 217 00:11:22.750 --> 00:11:25.300 and it would be great to organize these according to their meanings 218 00:11:25.300 --> 00:11:27.400 and learn them 219 00:11:27.400 --> 00:11:29.450 The reason why we use functions 220 00:11:29.450 --> 00:11:33.000 is to avoid having overlapping codes 221 00:11:33.000 --> 00:11:35.500 We can gather several duplicate codes 222 00:11:35.500 --> 00:11:37.550 and turn them into one 223 00:11:37.550 --> 00:11:40.850 That way, reading the code becomes easier 224 00:11:40.850 --> 00:11:42.450 and when you need to change the code 225 00:11:42.450 --> 00:11:44.400 only the body of the function needs to be edited 226 00:11:44.400 --> 00:11:47.000 and the part that defines doesn't need to be 227 00:11:47.000 --> 00:11:51.700 Functions are already used in console main 228 00:11:51.700 --> 00:11:54.000 and Unreal has countless functions 229 00:11:54.000 --> 00:11:57.000 They are used in application programming interface 230 00:11:57.000 --> 00:11:58.450 To put it easily 231 00:11:58.450 --> 00:12:01.600 in Unreal, to perform or run 232 00:12:01.600 --> 00:12:03.100 a function 233 00:12:03.100 --> 00:12:04.750 there is a function for that 234 00:12:04.750 --> 00:12:07.550 and there are many of them 235 00:12:07.550 --> 00:12:10.400 I gave a brief explanation about functions 236 00:12:10.400 --> 00:12:12.200 but apart from this 237 00:12:12.200 --> 00:12:13.450 there are many other topics on functions 238 00:12:13.450 --> 00:12:16.550 Call by value and call by reference 239 00:12:16.550 --> 00:12:18.250 determine whether a value 240 00:12:18.250 --> 00:12:23.000 or a pointer or reference will be input 241 00:12:23.000 --> 00:12:26.000 There is also recursion 242 00:12:26.000 --> 00:12:28.800 which is a function that defines itself 243 00:12:28.800 --> 00:12:33.000 You will also learn class' member function later on 244 00:12:33.000 --> 00:12:38.350 There is also function pointer 245 00:12:38.350 --> 00:12:40.900 which takes the defining part as the value 246 00:12:40.900 --> 00:12:43.350 so that the defining happens later 247 00:12:43.350 --> 00:12:46.000 meaning that the caller and callee are switched 248 00:12:46.001 --> 00:12:49.351 Statement and expression 249 00:12:50.450 --> 00:12:52.450 Next is statements 250 00:12:52.450 --> 00:12:55.550 Statements 251 00:12:55.550 --> 00:12:57.800 contain 252 00:12:57.800 --> 00:13:02.250 conditional statement, iteration statement, and break statement 253 00:13:02.250 --> 00:13:04.150 Statements, put easily 254 00:13:04.150 --> 00:13:06.650 are what controls the flow of a program 255 00:13:06.650 --> 00:13:09.000 The most basic example 256 00:13:09.000 --> 00:13:10.350 is an if statement 257 00:13:10.350 --> 00:13:13.000 if statements, according to certain conditions 258 00:13:13.000 --> 00:13:15.000 the divergence differ 259 00:13:15.000 --> 00:13:19.550 MSDN, Microsoft Development Network's 260 00:13:19.550 --> 00:13:23.000 website's URL on the bottom 261 00:13:23.000 --> 00:13:26.000 will give you an explanation on statements 262 00:13:26.000 --> 00:13:28.000 I will give you a brief explanation 263 00:13:28.000 --> 00:13:30.000 about how the code if works 264 00:13:30.000 --> 00:13:32.600 with a diagram 265 00:13:32.600 --> 00:13:36.000 On the left you can see a black circle 266 00:13:36.000 --> 00:13:39.300 which is one line of a code 267 00:13:39.300 --> 00:13:42.400 and at that point it meets a condition 268 00:13:42.400 --> 00:13:45.300 if a is true 269 00:13:45.300 --> 00:13:49.600 The triangle is called the diagram of the flowchart 270 00:13:49.600 --> 00:13:52.300 Depending on whether a is true or false 271 00:13:52.300 --> 00:13:53.500 the flow is divided 272 00:13:53.500 --> 00:13:55.000 If it's true, to the left 273 00:13:55.000 --> 00:13:57.300 and if false, to the right 274 00:13:57.300 --> 00:14:01.200 That was an example of an if statement 275 00:14:01.200 --> 00:14:03.000 and looking at the third diagram 276 00:14:03.000 --> 00:14:05.550 it uses continuous ifs 277 00:14:05.550 --> 00:14:09.000 where if then is used when the content of if is true 278 00:14:09.000 --> 00:14:11.000 and else is for when it's not 279 00:14:11.000 --> 00:14:15.000 When one condition is true 280 00:14:15.000 --> 00:14:16.300 it reaches end 281 00:14:16.300 --> 00:14:17.400 and if not 282 00:14:17.400 --> 00:14:19.400 it goes back to if 283 00:14:19.400 --> 00:14:21.500 which is shown in this diagram 284 00:14:21.500 --> 00:14:23.200 There are many other conditionals 285 00:14:23.200 --> 00:14:25.000 other than if conditional statements 286 00:14:25.000 --> 00:14:28.000 Switch-case has one condition 287 00:14:28.000 --> 00:14:30.700 and diverges multiple ways according to the value 288 00:14:30.700 --> 00:14:34.750 For example, depending on variable 2's value which can be 1, 2, or 3 289 00:14:34.750 --> 00:14:37.650 it diverges to the right like this 290 00:14:37.650 --> 00:14:41.700 Iteration means repeating a certain statement 291 00:14:41.700 --> 00:14:44.400 and for statements 292 00:14:44.400 --> 00:14:46.600 is a statement that gives a variable a beginning 293 00:14:46.600 --> 00:14:49.900 and end point and which repeats according to conditions 294 00:14:49.900 --> 00:14:52.000 According to the condition in the middle 295 00:14:52.000 --> 00:14:54.200 it can also break 296 00:14:54.200 --> 00:14:56.500 While statement is also an iteration 297 00:14:56.500 --> 00:15:00.750 In case the condition inside while is true 298 00:15:00.750 --> 00:15:02.700 it repeats endlessly 299 00:15:02.700 --> 00:15:05.200 Do-while is a while with a condition 300 00:15:05.200 --> 00:15:06.900 that first performs 301 00:15:06.900 --> 00:15:10.150 and then keeps editing according to the conditions that follow 302 00:15:10.150 --> 00:15:13.700 Among interations 303 00:15:13.700 --> 00:15:16.350 it can break from the loop 304 00:15:16.350 --> 00:15:18.000 or keep performing 305 00:15:18.000 --> 00:15:20.000 This is called break statements 306 00:15:20.000 --> 00:15:22.900 Having break or continue 307 00:15:22.900 --> 00:15:25.550 in the conditions 308 00:15:25.550 --> 00:15:27.950 it can break from the cyclical loop 309 00:15:27.950 --> 00:15:31.750 or ignore it and continue 310 00:15:34.000 --> 00:15:35.650 Now let's move on to expressions 311 00:15:35.650 --> 00:15:38.250 Expressions 312 00:15:38.250 --> 00:15:41.650 are elements like 313 00:15:41.650 --> 00:15:46.000 conditionals, values, variables, operator and function definition's 314 00:15:46.000 --> 00:15:49.500 combinations 315 00:15:49.500 --> 00:15:52.900 Put simply, it is an equation that can be evaluated as value 316 00:15:52.900 --> 00:15:56.800 Parts of the if statement like a is true or false 317 00:15:56.800 --> 00:16:00.800 or equal to 3 are expressions 318 00:16:00.800 --> 00:16:04.050 There are formula and discriminant in expressions 319 00:16:04.050 --> 00:16:08.100 What must be mentioned along with expression is operator 320 00:16:08.100 --> 00:16:09.950 which is 321 00:16:09.950 --> 00:16:11.400 literally what operates 322 00:16:11.400 --> 00:16:14.800 Arithmetic it mathematics can be a good example 323 00:16:14.800 --> 00:16:16.700 There are many types of operators 324 00:16:16.700 --> 00:16:21.050 which can also be seen on MSDN 325 00:16:21.050 --> 00:16:24.050 I made a table of operators 326 00:16:24.050 --> 00:16:27.800 There are operators with signs 327 00:16:27.800 --> 00:16:30.150 showing negative or positive 328 00:16:30.150 --> 00:16:32.500 and arithmetic operator 329 00:16:32.500 --> 00:16:35.200 for arithmetics 330 00:16:36.000 --> 00:16:40.900 and relational operators like not equal to, bigger or equal to, bigger, and smaller 331 00:16:40.900 --> 00:16:44.600 logical operators 332 00:16:44.600 --> 00:16:47.000 and operator and or operator 333 00:16:47.000 --> 00:16:51.000 cast operator that changes types 334 00:16:51.000 --> 00:16:56.500 increment and decrement operators, assignment operator, comma operator, and sizeof operator 335 00:16:56.500 --> 00:16:59.000 There are various operators in C++ 336 00:16:59.000 --> 00:17:02.350 Let me explain the most basic operator 337 00:17:02.350 --> 00:17:05.000 On the screen it says a=1 338 00:17:05.000 --> 00:17:09.000 In mathematics, this means that you substitute a with 1 339 00:17:10.000 --> 00:17:15.450 and in C++ as well, the constant 1 is substituted with the variable a 340 00:17:15.450 --> 00:17:18.000 The two equations under that 341 00:17:18.000 --> 00:17:21.850 are statements that increase the value of the variable a 342 00:17:21.850 --> 00:17:23.150 but the expression is a bit different 343 00:17:23.150 --> 00:17:28.750 The one on the left is substituting variable a with the value of a+1 344 00:17:28.750 --> 00:17:31.000 If the value of the variable a was 3 345 00:17:31.000 --> 00:17:34.600 3+1 is 4 so 4 is put in 346 00:17:34.600 --> 00:17:38.000 making a increase by 1 347 00:17:38.000 --> 00:17:41.000 The one on the right is a simplified version of the one on the left 348 00:17:41.000 --> 00:17:43.650 which means 349 00:17:43.650 --> 00:17:47.800 substituting a that is increased by 1 350 00:17:47.800 --> 00:17:52.000 Increment and decrement operator can also be used to express a increasing by 1 351 00:17:52.000 --> 00:17:56.200 It can be simplified even more to a++ or ++a 352 00:17:56.200 --> 00:18:00.750 Prefix and postfix expressions' difference is the order of 353 00:18:00.750 --> 00:18:04.000 substitution and reflection 354 00:18:04.000 --> 00:18:06.300 Relational operator is similar to mathematics 355 00:18:06.300 --> 00:18:09.000 and depends on the value of true or false 356 00:18:09.000 --> 00:18:11.550 Equality operators are similar to math as well 357 00:18:11.550 --> 00:18:15.400 and truth or falsity depends on whether it is equal or not 358 00:18:15.400 --> 00:18:20.150 Conditional operators diverge according to certain conditions 359 00:18:20.150 --> 00:18:23.000 which is similar to if statements 360 00:18:23.000 --> 00:18:26.000 According to the truth value of the 361 00:18:26.000 --> 00:18:27.650 statement inside the parentheses 362 00:18:27.650 --> 00:18:30.850 D or E next to the question mark is performed 363 00:18:30.850 --> 00:18:32.200 Next is cast operator 364 00:18:32.200 --> 00:18:34.800 Cast operator changes types 365 00:18:36.050 --> 00:18:38.750 It can change an int value 366 00:18:38.750 --> 00:18:43.150 to a float value that can have a real number 367 00:18:43.150 --> 00:18:47.000 It's not as simple as just changing types 368 00:18:47.000 --> 00:18:51.500 because integer 3.3 and real number 3.0 are different values 369 00:18:51.500 --> 00:18:55.250 So there needs to be a process of changing the value 370 00:18:55.250 --> 00:18:58.600 and a specific explanation can be found on the MSN page 371 00:18:58.600 --> 00:19:00.200 There are orders in operators 372 00:19:00.200 --> 00:19:02.150 You would have learned in mathematics 373 00:19:02.150 --> 00:19:04.600 but when there are several operators 374 00:19:04.600 --> 00:19:08.850 orders determine what is performed first 375 00:19:08.850 --> 00:19:12.900 Operators have orders and combination directions and rules 376 00:19:13.250 --> 00:19:17.650 For example, in mathematics, multiplication 377 00:19:17.650 --> 00:19:21.050 comes before addition 378 00:19:21.050 --> 00:19:22.550 and it is similar in operators 379 00:19:22.550 --> 00:19:24.750 When you're unsure of the order 380 00:19:24.750 --> 00:19:27.700 you can use parentheses that force orders 381 00:19:27.700 --> 00:19:33.100 Now we'll move on to C++ operators' orders and associativity 382 00:19:33.100 --> 00:19:40.650 On the top, there are square brackets, parentheses, period, arrow, ++ and -- 383 00:19:40.650 --> 00:19:44.600 which are increment and decrement operators that use equations 384 00:19:44.600 --> 00:19:47.300 When these operators are put in equations 385 00:19:47.300 --> 00:19:50.550 the calculation is done from left to right 386 00:19:51.200 --> 00:19:54.400 Simply, ++ operator 387 00:19:54.400 --> 00:20:02.000 in a++ means that a increases 388 00:20:02.000 --> 00:20:06.900 Second, sizeof, ampersand, asterisk 389 00:20:06.900 --> 00:20:11.250 which are and and multiplication 390 00:20:11.250 --> 00:20:18.700 +, -, ~, !, and ++ and -- for prefix 391 00:20:18.700 --> 00:20:22.000 These are unary operator with one operand 392 00:20:22.000 --> 00:20:26.700 These are operators that work on one subject 393 00:20:26.700 --> 00:20:32.000 and sizeof can figure out the size of a variable 394 00:20:32.000 --> 00:20:37.000 so it looks like sizeof(variable) 395 00:20:37.000 --> 00:20:41.000 & and * are put before a variable 396 00:20:41.000 --> 00:20:47.850 to bring value from the address value of that variable 397 00:20:47.850 --> 00:20:51.000 + and - operator that are not addition and subtraction 398 00:20:51.000 --> 00:20:54.800 represent positive or negative numbers 399 00:20:54.800 --> 00:20:58.000 and it lets us know the sign of a variable 400 00:20:58.000 --> 00:21:00.450 These are unary operators 401 00:21:00.600 --> 00:21:04.400 and in this case, the operator works when it is put from right to left 402 00:21:04.400 --> 00:21:07.200 You could think of -a or +a 403 00:21:07.200 --> 00:21:10.000 Casting operator is also unary 404 00:21:10.000 --> 00:21:13.400 and it casts one variable or type 405 00:21:13.400 --> 00:21:16.000 and changes it 406 00:21:16.000 --> 00:21:19.650 Next we have multiplication, division, and remainder operator 407 00:21:19.650 --> 00:21:22.350 which are related to multiplication 408 00:21:22.350 --> 00:21:24.000 and have two operands 409 00:21:24.000 --> 00:21:27.350 like multiplying A and B or dividing C by D 410 00:21:27.350 --> 00:21:31.450 They are operators that calculate the remainder of two values 411 00:21:31.450 --> 00:21:34.650 It goes from left to right 412 00:21:34.650 --> 00:21:37.350 like multiplying 3 by 2 413 00:21:37.350 --> 00:21:40.100 There are also shift operator and relation operator 414 00:21:40.100 --> 00:21:43.800 Shift operator shifts bit 415 00:21:43.800 --> 00:21:47.450 which moves binary numbers 416 00:21:47.450 --> 00:21:51.550 and also makes the result of multiplication by 2 417 00:21:51.550 --> 00:21:56.550 Relation operator includes larger than or smaller than 418 00:21:56.550 --> 00:21:59.150 like A is smaller than B 419 00:21:59.150 --> 00:22:02.650 or A is larger than B 420 00:22:02.650 --> 00:22:06.250 On the second page, there is equality operator 421 00:22:06.250 --> 00:22:09.400 In mathematics, only one = is used 422 00:22:09.400 --> 00:22:11.300 but in programming, two are used 423 00:22:11.300 --> 00:22:15.000 == means A is equal to B 424 00:22:15.000 --> 00:22:19.300 and != means A is not equal to B 425 00:22:19.300 --> 00:22:22.900 This also goes from left to right 426 00:22:22.900 --> 00:22:25.000 so it is read as A is equal to B 427 00:22:25.000 --> 00:22:28.450 A==B means 428 00:22:28.450 --> 00:22:32.200 A equals to B, not B is equal to A 429 00:22:32.200 --> 00:22:37.000 Bit operators are operators for bits 430 00:22:37.000 --> 00:22:44.750 logically like AND and OR 431 00:22:44.750 --> 00:22:46.650 and this also has the same 432 00:22:46.650 --> 00:22:50.250 order as equality operator 433 00:22:50.250 --> 00:22:55.450 There are also conditionals, simple and compound assignment, and sequential operators 434 00:22:55.450 --> 00:22:59.850 which also, like the ones mentioned earlier 435 00:22:59.850 --> 00:23:03.000 paying attention to the order must be noted 436 00:23:03.751 --> 00:23:05.201 Meaning of functions in C++ Data type The form to store data in computer memory 437 00:23:05.201 --> 00:23:06.801 int(integer), float(floating point), char(character), std::string(string), bool(boolean), void 438 00:23:06.801 --> 00:23:07.952 Variable The bowl for values, declared and defined based on data type 439 00:23:07.952 --> 00:23:10.853 Function Element that can independently perform a function Avoids duplicate codes Only edits function body when changing code 440 00:23:10.853 --> 00:23:12.717 Statements and expressions Statements What controls the flow of a program 441 00:23:12.718 --> 00:23:14.268 Conditionals: if, switch-case Iterations: for, while, do-while Break: break, continue 442 00:23:14.268 --> 00:23:16.400 Expressions Combination of elements like value, variable, operator and function definition Operator: sign operator, arithmetic operator, relational operator, logical operator, cast operator, increment and decrement operator 443 00:23:16.400 --> 00:23:18.250 substitution operator, conditional operator, comma operator, sizeof operator Must pay attention to the orders and associativity 444 00:23:18.250 --> 00:23:19.250 The End