Back from the grave

How long has it been? 2 moths? More? I don’t know, all I can say is that I have completely forgotten about writing in this blog, mainly because I have been occupied with other matters. Most of the time I have told myself: “Hey, I should write a post today…… Nah, I’ll do it tomorrow.” Procrastination at practice right there!

Anyhow, I have done all my homework assignments and have not tried COJ again. Arrays, vectors and pointers are some pretty nifty tools to program with, but they are as useful as they are tricky. One of the most difficult and most time consuming programs I have done involved the use of arrays to write a program that calculate the difference between to hexadecimal numbers. I had to take two character arrays as input, convert them to integer arrays to then turn those arrays into single integers I could subtract, and lastly convert the difference into an integer array to then turn it into a character array to display the number in hexadecimal base. It…. was…. tough.

Will I ever try a COJ program? No, at least not in the near future. However, if, say, some class or some job position requires me to know C++, I might just convince myself that trying out some darn COJ programs could be of good use to me to regain knowledge of programming methods. In the meantime, I will just worry about final exams.

Is this my last post in the blog? Yes. I only intended to write here as a form of journal, a public journal in any case, to expose my thoughts and experiences in learning C++. I have to admit I failed at maintaining a consistent writing schedule and my posts are probably not entertaining. At least now I know that I shouldn’t start a Youtube channel or some other equivalent to document my life, but I never had the desire to do something like that so that’s alright.

So long, farewell.

Posted in General | Leave a comment

It’s been a while

As the title suggests, I have strayed from posting for quite some time. When you have to study, you study, or else you will end up failing miserably. That is what I have been doing lately, aside from goofing off with friends and what not, but I did study a bunch.

Anyhow, I took my first programming test today and it when better than expected. Initially, I was lost because I did not know how to think some thing trough, like a Boolean expression ” myInt % 5 “. What is that supposed to mean, I thought in frustration and panic. Fortunately, I recalled the fact that integer type values are converted to bool values where anything other than zero is true. Now, I have no idea what happened in my brain when I was asked what would happen if the value of myInt were 15. I just went on believing there would be a modulus value that was true for the Boolean expression. It wasn’t until after the test that some of us classmates went over the test questions and one of them told me what he had answered in the question. I face-palmed myself: I could not believe the stupidity I had committed.  15 divided by 5 is 3, with no remainder, how could I have skipped that? Total lapse of attention. FAIL.

Posted in General | Leave a comment

The COJ SUM exercise

I finally got a correct submission! It was pretty confusing to be honest having to use a do-while statement and transforming the assignment statement so it works with the negatives and includes the positive integer 1. It would have been shorter if I decided to use Gauss in both parts of the body but I opted not to. I have not tried any other COJ problems after that due to other works but if I do have some spare time I will.

Posted in General | Leave a comment

A step closer to relief

There is a website call Caribean Online Judge, COJ for short, that posts programming problems solvable in different programming languages. When I started trying problems I grew frustrated as I wrote programs that did what COJ asked to, or I at least think I did what they asked for, but I ended up getting the program wrong. The only possible explenation is that I may not fully understand some of the specifications they put for the numbers, since some are no explicitly shown. Nevertheless, let me get to the point of this blog post.

A problem in COJ is called SUM, and it consists of writing a program that can add al the nimber from 1 to N where N can be no larger than the absolute value 10^4. I completely overlook the ‘absolute value’ part and jump straight ahead into making a program using the Gauss Method of Addition (not sure of the name, but it was Gauss who deduced it). The Gauss Method is a simple formula which gives the sum of all integers up the one designated. The formula is n(n+1)/2, where n is any positive integer, and trying it with 5 you obtain 15 which is correct. I put it as the function of the program but it was the wrong answer to the COJ problem. Now, I am writing a program with branches and loops and operators which is working so far. Lets see what COJ thinks about it.

I will post what happened when I finally solve the problem, if ever.

Posted in General | Leave a comment

Progress (although tiny) in programming

Today I turned to a page at the end of the first chapter of “Problem Solving with C++” by Walter Savitch where practice projects are given. I have already done one of them a few days ago involving a program that prints out “C S !” in large block letters, which proved more time consuming than desired considering one had to type a character and space to then type another character one by one. The project I attempted today appeared complicated at a first glance, but after actually thinking for a moment I knew what I had to do: I had to write a program that could count how much money one had in quarters, dimes, and nickels. I simply named the variables, put some output statements so the user knows what to type in,  assigned the total to be the sum of each quantity in cents, and gave the answer as part of an output statement. Surprisingly, only a few syntax errors where reported when compiling: some missing semicolons or a misspelled word. The program ran as intended without any logic errors. It appears the Emacs editor knows that multiplication goes before addition, saving me time.

Posted in General | Leave a comment

¡Hola, mundo!

Bienvenido a Edublogs RUM. Esta es tu primera entrada. Puedes editarla o eliminarla.

Posted in General | 1 Comment