This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
blog:spring2016:btaylo15:journal [2016/01/18 21:05] – external edit 127.0.0.1 | blog:spring2016:btaylo15:journal [2016/04/21 03:37] (current) – btaylo15 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
======C/C++ Programming Journal====== | ======C/C++ Programming Journal====== | ||
- | ====MONTH Day, YEAR==== | + | \\ |
+ | |||
+ | ==== Jan 19, 2016 ==== | ||
+ | I remember when I wrote a research paper on Linux in freshman year of high school. Well, no time like the present to learn about the past (get it, because UNIX came before Linux). Coming from Windows command prompt, UNIX seems pretty simple once you know the commands. I've used an actual floppy-based DOS computer before, so mostly mouse-less computing doesn’t faze me. Figuring out the write command was fun. I wrote and compiled the Hello World program in C, adding in a second line to personalize it just for kicks. After figuring out the trick to multiplying by 11, I already have ideas on how to code it, I just need to learn how to do it in C. I also have ideas for making Pong, as well.\\ | ||
+ | |||
+ | ==== Feb 2, 2016 ==== | ||
+ | Having already done the 11's mental math program, the fives was not too hard. However, when splitting the input into an array, the numbers were converted to their ASCII codes. I converted them back by subtracting the ASCII equivalent of 48, " | ||
+ | |||
+ | ==== Feb 8, 2016 ==== | ||
+ | I have enjoyed these mental math programs we have had to write, as well as C programming in general. The first day of the year calculator was fun. After finishing years 2000 to 2099, I started entering years higher than that. After examining the results, researching what I consider “leap centuries”, | ||
+ | |||
+ | ==== Feb 22, 2016 ==== | ||
+ | Coming into this course, we noticed the graph of the grades for last semester' | ||
+ | |||
+ | ==== Feb 29, 2016 ==== | ||
+ | This project has been the most complicated one so far. Back in Computer Essentials, we learned about how the highest levels of encryption use prime numbers, so going in to a project where people literally study this for it to be their careers was a little overwhelming at first. Starting with brute force, we all used the same algorithm, checking all numbers between 2 and a max number to see if they divide evenly by anything other than 1 and itself. If a number isn’t, then it is prime. This method is 100% effective, but very slow for high numbers. For the next iteration, the brute method can be optimized using the sqrt() function. For any prime number, you only need to check if it is divisible by numbers from 2 to the square root of the max. This greatly reduces the run time. For the final iteration, we were allowed to use algorithms or optimizations we want to try and get the best time we can. I decided to use the Sieve of Eratosthenes for my algorithm. My best time as I’m writing this is 3.355351s for the 67108864 range.\\ | ||
+ | |||
+ | ==== March 7, 2016 ==== | ||
+ | All I can say is that it is a big relief to not have to optimize every little thing in this week's program. After going a little overboard on the prime number project and winning, it feels nice to be able to take it easy on a project, but that doesn' | ||
- | This is a sample format | + | ==== March 14, 2016 ==== |
+ | This project was pretty fun. I learned about this project early as well, so I had a plan going in to it. Probably | ||
- | As an aid, feel free to use the following questions | + | ==== March 22, 2016 ==== |
+ | Inputting a string and then shifting | ||
- | * What action or concept of significance, as related | + | ==== April 4, 2016 ==== |
- | * Why was this significant? | + | Making a hex viewer? No problem. Coloring in the lines? Problem. By using an array to temporarily store consecutive sets of 16 bytes from a file, and using the hexadecimal format specifiers, creating a program to open a file and display its contents in hexadecimal and ASCII was easy. I used code from previous projects to open the file and fgetc its contents. The hardest part of the main project was detecting EOF at the right time. To do this, I put the section for storing the data into the temporary array first in the “for” loop, and if feof was detected, a flag was set and the position of the last character in the file was set. Then I print the offset, hex and ASCII values. Then there’s adding color. I was able to figure out how to correctly store 6 pairs of extra arguments to be used as highlighted sections, but actually implementing it was difficult. By the end, for some reason, my program only correctly highlights when 4 or fewer pairs of arguments |
- | * What concepts | + | |
- | * What challenges are you facing with respect to the course? | + | |
+ | ==== April 13, 2016 ==== | ||
+ | This was a relatively easy week for me, since I did this project weeks in advance because I got bored. The project was to subtract any number from the power of ten with one more digit than the input number. You can easily do this by subtracting each number left to right by 9, then the last by 10. I got it working easily, however, upon further testing I found a very specific bug. Whenever the program did 10 – 0, it returned a 10 of course, but this means that 1000 – 100 = 8100, or 8 10 0. I fixed this by looping back through the result array and fixing the carries. Going back to mental math programs was a nice break and refresher on certain parts of code.\\ | ||
+ | ==== April 20, 2016 ==== | ||
+ | This week’s project was pretty fun. We used the flattenstatus command to get our grade data and then display it in a readable way. For me, my grade in this class is about a 113/100 because of all the bonus I did, so that’s nice. I learned a bit about floats for this project, since I wanted to have the option of decimals instead of truncating every number into int form, and it was necessary for dividing my accumulated points by the total possible points. This project, at least the part where you read data with what are basically headers separating the sections, reminds me of my personal project I’ve been working on, Secret Picture Messages (spm0). My program encodes 24-bit bitmaps with a secret message, and the picture looks no different to the original. Anyway, I’m already thinking about how to solve the EOCE projects and I’m excited to try my ideas. |