Tag Archive: C++


So i had a little time to program something.. I decided to create a simple program to calculate gst, gross income and net income based on my hourly rate and how many hours I worked in a week..

Here is my simple equation..
grossPay = rate * workHours * 1.125
myGst = rate * workHours * 0.125
netIncome = rate * workHours * 0.75 + myGST

However it gets complicated when overtime pay comes in but I have integrated a solution in my little program..
c_gst_simple

How old are you?

In order to create a simple command line based program I used Visual C++ 2008 Express to compile the code below.
It basically opens up a dos type window, in which you will see a question “How old are you?” then you can type in how old you are.. then it returns an answer.. very simple.

In the header.h
#include <iostream>

Add this in the source.cpp

#include "header.h"
using namespace std;
int main ()
{
int myAge;
cout << "How old are you?";
cin >> myAge;
cout << "My age is " << myAge << ".";
system("pause >nul"); // keeps window open instead of closing after typing age
return 0;
}

Note: should mention that “end1″ in cout lines gave errors when compiling in the visual express..

WordPress engined.