I received the results of one of my tests on Wednesday, and caused a bit of a debate with my professor. It was in C++ class. One of the practical portion questions was pretty simply:

Write a piece of code that will use a for loop to calculate the number of digits in a positive integer (Hint use division by ten)

So I created a short, simple function:

int digits(int num)
int i;
for (i = 0; num > 0; i++, num /= 10);
return i;

To my surprise, I only got 3 out of 4 on that question. Apparently, the loop was supposed to start at 1 (rather than 0), and the test changed to > 9. This would result in 0 having one digit.

Read the rest of this entry

, ,

First, my apologies for the lack of posts in a bit while long time. I’ve been busy with moving, school, work, TF2, Warhammer 40K, and MTG. Just so much stuff to do, so little time.

About moving in. It actually went pretty well. We had been packing things into boxes for a few weeks before. We tried to keep similar things together, including glass items, bedroom stuff, etc. So we were decently organized, and only needed a little bit of rearranging at the last minute.

Read the rest of this entry

, , ,