Hey everyone, I'm new to this site. one of my classmates told me about it so I'm giving it a try. anyway, for my class I need to write a code for a payroll program.

so far, this is what I've written...

//Assignment 4
//Page 218
//Question 7

#include <iostream>
#include <string>


using std::cout;
using std::cin;
using std::endl;
using std::string;

int main()
{
    //Variables
    int hoursworked = 0;
    int weeksworked = 0;
    int daysworked = 0;
    int hoursleft = 0;
    string name = "";
    
    //Input
    cout << "Enter the name of the worker please: ";
    getline(cin, name);
    cout << "Enter the total hours worked please: ";
    cin >> hoursworked;
    
    //Calculate

.
.
.
.
.

so basically I'm confused on what I'm calculating. reason being is because I need the output to display hours worked in a this format... hours worked is 70, so the output should read 1 week, 3 days, 6 hours. this is assuming the work week is 40 hours with 8 hour days.

Edited 5 Years Ago by Narue: added code tags

Burn August Red
Deleted Member

right, I remember doing stuff like that in class with the remainder. but I can't really remember how to code that in terms of
weeksworked = hoursworked / 40;

right, I remember doing stuff like that in class with the remainder. but I can't really remember how to code that in terms of
weeksworked = hoursworked / 40;

Then you'd better start reading your book and asking questions in class. We are not a tutorial forum. Nor are we a homework service forum.

Edited 5 Years Ago by WaltP: n/a

This article has been dead for over six months. Start a new discussion instead.