C++ Live Blog: Payroll Program Part One


I found this fantastic image at http://morganpawprint.com.  On a special note, I took some time to explore the Morgan Paw Print Blog and I was impressed.  I thought it had a simple, inviting, and well organized layout.  Kudos!

As a change of pace I thought I might do a bit of live blogging tonight as I work through some code in C++.  Which if I’m being honest is a bit brave on my part.  As a noob to C++ my talents leave something to be desired…still here goes.

10:00 pm. I throw on some LINKIN PARK [REANIMATION] just for the ambiance…


Tonight’s task, continue to work on the payroll program I’ve been coding.  To date I’ve used Bloodshed’s DEV-C++ compiler to code a basic console program that allows a user to enter data for a series of employee’s and automatically calculates net pay by deducting a a tax amount at a fixed rate of 20%.  As an example I’m working out of Dr. Alireza Ebrahimi’s book C++ Programming:  Easy Ways.  Here’s what I’ve got so far…


Here’s my output, sampled using data on four employees:


11:14 pm.  Next task, revise program to pull data from a data file.  There’s a cricket in my office competing with my thoughts as I review the nuts and bolts of how to do this.  It’s a little maddening.  I love crickets though…when they’re outside…and I’m staring up at the stars; not when they are stealing my concentration while coding…

11:53 pm.  Revised code to remove references to old manual entry of data being stored in variables.  I still haven’t gave the program the functionality it needs in order to access the data file.  I’m also not sure I’ve established the variables I need correctly.  Specifically, hourlyrate.  My uncertainty stems from the fact that the variables are of two different types (int, and float).  My newness shining through. I’m not sure how C++ differentiates; or if it does.  Revised code:


12:08 am. Switched soundtrack to Beautiful Eulogy’s Satellite Kite.  Awesome album…


For kicks save,compile, and run…

Forgot that I removed the reference to numberofemployees.  Compiler generated error telling me that the variable was not declared.  Removed code reference to the variable.  Save, compile, and run.


Awesome!  The program compiled and executed fine…although nothing was displayed in the console.  I think the next step is to add code pointing at the data file to feed the program.  Alas, it’s late and that will have to wait until morning.

Any pointers?


One comment

  1. Pingback: Payroll Program: Part Two | TeknicalGrit

Join the fray...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s