Create a 50x8 int array to hold the employee’s data, and a size 50 string array to hold the employee names.
Read all the employee data into arrays
Total number of hours worked in the week and store it in the int array at either location 0 or 7, whichever make sense to you. Create a const variable to make it obvious in your code what you are doing. Example: hour[ i ] [ TTL_HRS ] = total;
Sort the employees by the total number of hours they worked for the week. The sort should be in descending order (most hours to least)
Write out the information to the console
the output is supposed to look like this.
Employee Weekly Hours:
Name: S M T W T F S TTL
Kirk,James 10 10 0 10 12 0 0 42
McCoy,Lenard 0 4 0 8 4 0 2 18
Scott,Annis 1 6 2 0 0 1 0 10
by bringing them into arrays but i can't figure out how to read in the files into 2 arrays with different data types on separate lines with one being a 2d array and the other being string. And assigning the hours to specific names. I've looked everywhere...and I'm stuck
obviously with the names of the file you read in ( i was just showing format... and the totals are going to be in descending order which i will be using bubble sort for in a separate function) i only am SUPER stuck in the array section. thank you for any help you can provide.
Create a 50x8 int array to hold the employee’s data, and a size 50 string array to hold the employee names.
Read all the employee data into arrays
Total number of hours worked in the week and store it in the int array at either location 0 or 7, whichever make sense to you. Create a const variable to make it obvious in your code what you are doing. Example: hour[ i ] [ TTL_HRS ] = total;
Create a 50x8 int array to hold the employee’s data, and a size 50 string array to hold the employee names. Read all the employee data into arrays
Firstly, write a program that fulfills this requirement (Only this requirement). Then show us your effort and we will be correcting your mistakes if any.
okay so the problem is... i know how to create arrays. haven't even the SLIGHTEST clue how to read it in with this set up.
in this case i think it would be
string name;
string namearr[50];
int hours;
int hrarr[50][8]; // creates the arrays i will need (keep in mind i am VERY amateur with arrays.
and i used this code for reading in int only on a mini code exercise but i tried to alter things for 3 days to figure it out for this and all i could get it to do was to read back one name. and the code below doesn't even work at all for string so i just got stressed and here i am