Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <cstdlib>
- using namespace std;
- double hire(float date) { //Takes date from main() for int part of row[0] of column[i]
- double employees[3][4], pin, id;
- int input, hours;
- float payrate;
- cout.precision(3);
- bool flag = false;
- while (!flag) { //Checks for proper employee
- cout << "Which employee's information would you like to alter? (1, 2, or 3): "; //Ask user for employee
- cin >> input;
- if (input == 1 || input == 2 || input == 3) {
- flag = true;
- }
- else {
- cout << "Sorry, but that's not an option. Please try again." << endl; //Restarts while() checker
- }
- }
- cout << "You are now editing employee " << input << "'s information." << endl << "An ID number is being assigned. Please wait..." << endl; //Assigns employee[i] an ID number
- Sleep(750);
- double pinholder = (double)(rand() % 1000);
- pin = pinholder / 1000;
- id = date + pin;
- cout << fixed << endl << "Employee " << input << " has been assigned as: " << id << endl; //Displays and fills employee hiredate and ID in row[1] of column[i] to user
- employees[input - 1][0] = id;
- cout << "Please enter employee " << input << "'s hours, to the closest rounded whole number: "; //Fills column[i], row[1] with hours of employee
- cin >> hours;
- employees[input - 1][1] = hours;
- cout << "Please enter employee " << input << "'s payrate: "; // Fills column[i], row[2] with the payrate of the employee as $$.$$
- cin >> payrate;
- employees[input - 1][2] = payrate;
- cout.precision(2); //Changes decimal precision to 2 places, for cents in a dollar
- cout << "The gross wages of employee " << input << " for this month were $" << hours * payrate << "."; //Displays and fills column[i], row[3] with gross wages of employee
- employees[input - 1][3] = (hours * payrate);
- cout.precision(3); //Changes decimal precision back to 3 places
- return 0;
- }
- int main() {
- double date, day, month, year, i = 1;
- cout << "Welcome! Please enter the current year: ";
- cin >> year;
- Sleep(500);
- cout << "The current year is " << year << "." << endl << "Please enter the current month (numerically): ";
- cin >> month;
- Sleep(500);
- cout << "The place of the current month is " << month << "." << endl << "Please enter the current day: ";
- cin >> day;
- Sleep(500);
- cout << "It is currently the " << day << "th day of the " << month << "th month, in the year " << year << "." << endl << endl << endl;
- date = (month * 1000000) + (day * 10000) + year;
- hire(date);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement