User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

journal:spring2020:cdevlen:week8 [2020/03/12 08:30] external edit
journal:spring2020:cdevlen:week8 [2020/03/18 15:42] (current)
cdevlen [MONTH Day, YEAR]
Line 1: Line 1:
 =====cprog week8===== =====cprog week8=====
 ---- ----
-====MONTH DayYEAR====+====March 182020====
-Filler text- your entry goes here; remove this line to receive full credit.+This week, I discovered the use of argv[0] for my sam0.c project. The actual encoding and decoding math portion (excluding wrapping a to z) was fairly simple, and I found most of my time was actually spent trying to get both encode and decode in the same program. That's where argv[0] came in, as it is the name of the file being run. Seemingly, a simple if() statement would do the trick for differentiating between encode and decode. That was not the case, however, as I had to find a new command called strcmp(). I used strcmp() around the argv[0] value to compare it to a string filename, and verify the statement was true, by using a lengthy if() statement, (if(strcmp(argv[0],"​./​encode"​)==0). This worked perfectly. Now my only issue is wrapping a to z if the key value is over 26, or if the value of a letter ​goes over 26. For the pct8 project, I was very stumped for quite a while working on it. I had to devise a new way of solving it, which basically meant taking the one number I found (K=9), and plugging it in to subtractions with 2 unknowns that had an established rule. For example, I knew H had to be half of L, and I had the subtraction K-L=H. Plugging in all the limited possibilities for H, and comparing them to the limited possibilities of L, I could narrow my numbers. This worked great, and is certainly a strategy I plan to use in the future. Overall, I think this week went really well in terms of time management and question asking, I asked many questions, started the project somewhat early, and was definitely benefited by it.
journal/spring2020/cdevlen/week8.txt · Last modified: 2020/03/18 15:42 by cdevlen