C++ Date and Time


I need help please. I am new to C++. I want to create a program that would compute the weekly salary of the employees. The program would accept TIME-IN and TIME-OUT inputs then get the total hours for the day. The time format is in 24 hour format (e.g. 13:00 is 1:00 pm). I also want to get the total hours for the week.

Inputs: (are underlined)

Employee Number: 12345
Name: Josef Alarka
Salary Rate: 380.00
Time-In for Monday: 08:00
Time-Out for Monday: 17:01
.
.time in, time-out from monday to friday.
.
Time-In for Friday: 08:00
Time-Out for Friday: 17:01
Coverage Date: June 11-15, 2009

Outputs:
************************
Employee Number: 1234
Name: Josef Alarka
Salary Rate: Php 380.00 (with currency format. still i don't know how to format this)
************************
Date Covered: June 11-15, 2009
Total Number of Hours Worked: 40 hrs.
Net Income: Php 1900.00
************************

Any help is very much appreciated. Thank you very much.
What, specifically, do you need help with?

And if you want "currency format", what about this:
std::cout << "$" << dollars << "." << cents << "c\n";
Last edited on
You should make arrays to handle the data...

Then use the cout or ofstream to write it to a file....

Then you could print it out,give it to people, etc.

closed account (jLNv0pDG)
Rather than using one integer for "dollars/pesos" and another for "cents/centavos"; would it not be easier to just use a float/double type?

1
2
3
float php;

std::cout << "Net Income: Php " << php  << endl;
Last edited on
It would be easier but less correct due to inexact floating point representation.

Probably best is to keep just a cents variable and not differentiate between dollars and cents.
Topic archived. No new replies allowed.