Welcome back to my in depth! I hope you’ve had a good two weeks since the last post! Since last time, my mentor has been teaching me some new codes and some ways to implement the code. She’s started to take a more independent approach where she just supplies me with the necessary information, and has me problem solve to find how to apply them myself. So after teaching me some material, I’ve been assigned a project where I will need to convert the code into a functioning program. Of course, if I’m completely stumped she will help me out with hints.

So, what exactly did I learn this week? We mostly focused on code that has to do with the calculation of numbers. For example, some of the code that I learned includes how to create variables with decimals, basic arithmetic, and a bit of expanding on previous codes like cin and cout.

To begin with, let’s go over a code called doubles. In my previous posts, I believe that I went over a code called integers that basically allowed you to have numerical variables. Now, the main drawback with integers is that you can only have integers. (It’s kind of in the name) This means that you cannot have variables with decimals. So then, how do you create variables with decimals? That’s easy, you can simply use a code called doubles. This is basically the same as an integer and works similarly except that it can have decimals. However, this brings up the question that I asked my mentor, why do integers even exist? Why not just have doubles as the main way of displaying numbers? The simple answer is just that doubles have very bad rounding errors. In specific situations, the code will round the decimal, but it is not capable of looking at the number and deciding whether to round up or down. So, it will always just round down. This can cause heavy calculation errors, but there are ways to fix this problem. It’s just that it is very difficult to control these errors, making doubles very beginner unfriendly.

Moving on, there is basic arithmetic. This section is relatively easy as it is simply + for addition, – for subtraction, * for multiplication, and / for division. However, there is actually a fifth operator called mod. Mod is represented by a % and a pretty unique operation. When you mod two numbers you are basically dividing the two numbers and finding the remainders. The outcome of the equation will just be the remainder. If this is confusing, don’t worry, I was extremely confused as well, which is why I had to ask for clarification. Since I’m a very visual learner, I mentor if she could explain it in a more visual way. Initially, I was expecting her to show me some equations, but she had a very good visual example prepared.

“So, imagine a circle with points around the circumference, kind of like a clock. Now for an example, lets get the equation, 2 % 12. The second number, 12 represents how many points there are around the circle.”

“Then, the first number basically represents how many steps you’re going to take around the circle, starting from zero. In our example, the first number is two, so if we take two steps from zero, we land on two. So the answer to 2 % 12 is 2.”

“Now, let’s take a more complicated example using the same diagram. Let’s go with… 17 % 12. Since the second number is still 12, the number of points around the circle stays the same. However, this time, we will take 17 steps from zero. So, if you take 17 steps from zero, you will lap around once, and then land on five. So, the answer to 17 % 12 is five.”

Thanks to this excellent example from my mentor, I was finally able to understand it well, and even have a really good understanding about how it works.

Now, the expansions on the cin and cout functions weren’t exactly as important or as exciting, so I’ll skip over it for now since I’ve dragged this long enough. Overall, our meeting looked very much like a one on on lecture style learning. There was very little hands on (evidently shown through the lack of media on this post) as we focused more on understanding the concepts on a deeper level. Much like this post’s chapter in *How to have a beautiful mind*, this week’s meeting had a heavy focus on listening. In my opinion, my mentor was an excellent teacher this week as she constantly checked in, making sure that I understood each and every concept to the extent she did. She had the answers to my questions prepared before I had even asked, and her explanations were so thorough that I rarely had to interject with any questions. This week especially showed how beneficial it can be to just listen.

Thanks for dropping by today to visit my blog post! I promise that next week will be a lot more exciting with an actual program heading its way to completion. So until next time, plus ultra.

-MJ