I'm currently trying to write a program. I'm new at programming and horrible at math. It is due tomorrow. I need to display the weeks, days, and hours a person worked based on the hours the person worked that month, which could be any number. A week is 40 hours, a day is 8 hours, and however many hours are left. I already wrote up my code and ran the compiler. However, the calculations are way off. I just need to know how to calculate the weeks, days, and hours.
I included the variables I declared and the calculations. Thank you.
//declare variables
int hoursWorked = 0;
int hoursPerWeek = 40;
int hoursPerDay = 8;
int weeks = 0;
int days = 0;
int hours = 0;
//calculate weeks, days, and hours
weeks = (hoursWorked - hoursPerWeek)/ ;
days = weeks - hoursPerDay;
hours = days;
2007-02-12
16:20:53
·
5 answers
·
asked by
Christi
4
in
Computers & Internet
➔ Programming & Design
I'm writing this in C++ using Dev-C++
2007-02-12
16:34:29 ·
update #1