Programming!

This marks the end of my fist week with programming.  Previous to this week I’ve programmed a bit in my spare time, but that was some years ago, and two years ago I took a class in Web development. This helped me get through this week without much problems, even though it took some time to get back into it, especially since I programmed in Visual basic then as opposed to C++ now.

This week we had introduction to programming, and went through the basics like how to write the classic “Hello World” program. We also made somewhat more advanced stuff including a guessing game where you guess a random number picked by the computer. I also made the extra task of reversing the guessing game, making the computer guess a number you picked.

Really the only thing that caused me some problems this week was the random number guessing, at first I didn’t understand when googling about it, but after discussing with a classmate we managed to figure out how it worked and I could then use it in the guessing game. To describe it fast, I had to use a function called rand(); to generate numbers, but since it’s only pseudorandom I had to change the input seed for rand(); with srand(); using the exact time of my computer at the time of code execution, this produced a random number every time I used it.

All in all, I’m very excited to start with programming and looking forward to next week where we are supposed to learn about pointers for memory management I think, and also program a clone of the classic game pong.

Pictures from the code will be up soon!

Leave a comment