Prime 357

We'll learn something

Site Menu

  • Home
  • Recent Posts
  • Forum
    • Programming Languages
      • C++
    • Website Design & Content Management
      • Wordpress >> Drupal
  • Blogs
  • Topics
    • C++
    • Changing hosts - Dummies Guide
    • Wordpress >> Drupal
  • Download Centre
  • Contact us
Home Blogs Steve's blog


Image - OpenID

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password

Navigation

  • Recent posts

Topics

  • C++ (The Book)
  • Changing Hosts - a Dummies Guide
  • Wordpress to Drupal

Recent comments

  • Got it solved This page here
    1 hour 49 min ago
  • Links working
    1 day 1 hour ago
  • Thanks... I may be able to
    1 day 7 hours ago
  • 3306 by default
    1 day 17 hours ago
  • Is this the right place to
    1 day 18 hours ago
  • Figured
    3 weeks 6 days ago
  • I'm guessing at this stage
    3 weeks 6 days ago
  • WordPress MU?
    4 weeks 2 hours ago
  • Thanks
    10 weeks 1 day ago
  • I'm running the conversion
    11 weeks 4 days ago

New forum topics

  • What should the port number be
  • WordPress MU?
  • funny little bug in mac version
  • Error: Unable to Insert into Node_revisions table when converting from wordpress 2.6.0 to drupal 6.4
  • index.php?
more

Who's online

There are currently 1 user and 0 guests online.

Online users

  • Steve

Who's new

  • oODeathStormOo
  • leruffiant
  • Emtee
  • mnogodet
  • ZioMimmo

Week 14 - Getting there

  • View
  • Revisions
Submitted by Steve on Sun, 24 Feb, 2008 - 21:12
  • C++
  • study
C++ Study w/e 24 Feb 2008
Week #:
14
Week Hours:
16.2
Total Hours:
157.6

Study wise, a very productive week, 16 hours spread over 5 days. When I say 16 hours I mean 16 hours. I use a stop-watch program to keep track of the hours and religiously stop it when taking breaks. At the end of this process (studying from the book) it'll be interesting, well for me at least, knowing how much time, both in hours and weeks, were spent in order to attain a certain level. This particular figure will be a yardstick for further C++ study (I'm thinking in terms of GUI programming).

Continued with Chapter 11, the programming exercises, completing them and the chapter on Thursday. The programming exercises were relatively straight forward.

Back in week 5 I wrote a program, which was not a part of the book, merely to test my knowledge at that point in time. That program, being a simple single source code file, accepted user input of distance and time (broken down into component time parts), calculated the pace (mins/km) and displayed it.

I revisted that program and completely re-wrote it, this time incorporating Class and Objects and the inclusion of multiple source code files (headers and .cpp's).

  1. Each run (distance & time - duration) is an object of the Class Run
  2. Each object now accounts for a user defined distance units (km or miles)
  3. The class handles all user input, calculations and output
  4. Created a functions.h and functions.cpp file which holds the function necessary to clear the input buffer. This sequence of code used in numerous places throughout the program, therefore an ideal candidate to form a function
  5. Fixed output display whereby previously for seconds, if less than 10 seconds, only one digit was displayed ie 5:2 (5 mins 2 secs) should be 5:02.
  6. Regardless of the user inputted distance units, displayed also is the opposite version, so if kilometres is selected, mins/km is displayed and then mins/mile displayed. This was an afterthought, but it highlighted how easy programming with objects and classes really is. It only took a few addition lines of code to achieve it. I was using what I had already written. At this point the light globe lit up.

The program is nothing earth shattering, it was simply done to cement my learning to date. I believe this is the process where learning actually takes place.

I know in time I'll look back on this code and probably cringe, as I did viewing my program written back in week 5.

Briefly touched on Chapter 12, Classes and Dynamic Memory Allocation, and that's where I'll continue from next week.

  • Steve's blog
  • Login or register to post comments
  • 183 reads

 Subscribe in a reader

free hit counter


RoopleTheme