Example 1 -
Write a program that inputs the number of hours that an employee works and the employee's wage. Then display the employee's gross pay. (Be sure to prompt for input).

(a) By looking at the question, we can see that we need two variables to perform calculations. One for hours worked and one for wage.

Since dollars need two decimal places and it is possible to work a half an hour, for example, we know that both of these variables need to be floating-point numbers.

(b) We also need to output gross pay, so that's a third variable, again a floating-point number since it will also be a dollar figure.

(c) Next, we need to understand how the calculation is to be performed.

In this case, we know that gross salary is simply hours worked multiplied by wage.

(d) The question also states that we must prompt the user for input.

So we know that we will need cout and cin statements, so we have to include the <iostream.h> library.
Our resulting pseudo-code is as follows:
#include <iostream.h>
int main() {
declare 3 floating-point variables: employee_wage, hours_worked, and gross_pay;
output to screen what program does;
prompt user for employee_wage;
accept input from keyboard for employee_wage;
prompt user for hours_worked;
accept input from keyboard for hours_worked;
calculate gross_pay = employee_wage * hours_worked;
display calculated gross_pay to the screen;
} // end main.

Now we can code in C++. View the source code.