Also since your asking for help on a English site, maybe adding a comment in English would also be helpful. I can use a translator but that takes up more of my time.
I have two files. One with ID, Name and Surname of employee and secund one is with their ID and number of hours in each day they work.
I need to sum these hours.
So after you open the second file, use a while loop to read the file.
add a if statement to see if the ID is the same as the last one you read, and if yes then add the hours to the total hoursforweek. if no print your data and clear hoursforweek before you add more to it. It's going to be helpful to print out each line and calculation you do until your sure it all works.
or is there any way tu sum like 7:15 and 8:30 to 15:45 ?
"7:15" and "8:30" are strings.
First convert to type double
double a = 7 + 15/60.0;
double b = 8 + 30/60.0;
hence a = 7.25, b = 8.5
sum a+b = 15.75
To convert back to a string, you need to separate the integer and fractional parts, 15 and 0.75
minutes = 0.75 * 60.0 = 45
Then join it all back together as a string.