I am attempting to create a program for costing allocations to different projects.
I would like to ask for the number of inputs to determine a 2D array size.
I would like to input the project number, followed by the number of hours charged to the project. I want the program to then find duplicate projects that have been entered into the array and add the hours together.
Eventually I need to know the percentage of each project but I'm not there yet. For now I'm just trying to figure out how I can get the program to read the duplicate project numbers and then add the hours together. Here is what I have so far:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string EmployeeFirst;
string EmployeeLast;
string Project;
string Hours;
int Entries;
cout << "Welcome to ___ Costing Allocations\n" << endl;
cout << "Employee First Name: ";
cin >> EmployeeFirst;
cout << "Employee Last Name: ";
cin >> EmployeeLast;
cout << "Number of Entries?: ";
cin >> Entries;
Employee First Name: Test
Employee Last Name: Subject
Number of Entries?: 3
-------------------------
Project: 11400
Hours: 8
Project: 11500
Hours: 4
Project: 11400
Hours: 2
I need the program to recognize that there are two entries for 11400 and add them together. Would anyone be able to help with this? Thanks in advance!!
This code gets a project name and number of hours from the user, then checks if table contains the key ProjName. If it doesn't it creates an entry with key ProjName and an hours value of zero. The number of project hours is then added.