Show up in work

I got arry of
Monday
Thusday
Wendsday
Thursdau
Friday
Sonday
Satrday

evry one is arry

1 8:00 8:00 4:30 8:00 8:00 0:00 8:00
2 8:00 8:00 4:30 2:30 7:00 0:00 8:00
3 8:00 4:30 8:00 2:30 6:00 0:00 8:00
4 8:00 4:30 7:00 8:00 5:30 0:00 4:00
5 8:00 7:00 7:00 8:00 0:00 0:00 4:00
6 8:00 7:15 8:00 8:00 3:00 0:00 4:00
7 8:00 8:00 8:00 8:00 2:00 0:00 2:00
8 8:00 8:00 8:00 8:15 1:00 0:00 2:00

And i need to find out when somebody show up ion work
1 = 1 day
2 = 2 day;
...

Is there any nice way ? :D


And i need to find out when somebody show up ion work

What do you mean by ion work?
Soory mistake.
I mean show up in work.
Lets say Jonny have been in work

Monday 8:00
Thusday 8:00
Wendsday 4:30
Thursdau 8:00
Friday 8:00
Sonday 0:00
Satrday 0:00

thats 6 days

And I need to write code that will do that.
Is this a text file, or is it the contents of your array?
1 8:00 8:00 4:30 8:00 8:00 0:00 8:00
2 8:00 8:00 4:30 2:30 7:00 0:00 8:00
3 8:00 4:30 8:00 2:30 6:00 0:00 8:00
4 8:00 4:30 7:00 8:00 5:30 0:00 4:00
5 8:00 7:00 7:00 8:00 0:00 0:00 4:00
6 8:00 7:15 8:00 8:00 3:00 0:00 4:00
7 8:00 8:00 8:00 8:00 2:00 0:00 2:00
8 8:00 8:00 8:00 8:15 1:00 0:00 2:00


Can you show the code you have written so far for this.
This is part of arrays.
Monday[8]= {8, 8, 8, 8, 8, 8, 8, 8, }
Thusday[8] = {8, 8, 4, 4, 7, 7, 8, 8, }
Wendsday[8] = {4, 4, 8, 7, 7, 8, 8, 8}
Thursdau[8] = { 8, 2, 2, 8, 8, 8, 8}
Friday[8] = {8, 7, 6, 5, 0, 3, 2, 1 }
Sonday[8] = {0, 0, 0, 0, 0, 0, 0, 0}
Satrday[8] = {8, 8, 8, 4, 4, 4, 2 , 2}

This is exactly how i have data in my array.
And I dont know how to write for thath code.
I thought by if but that will be 49 if.
1
2
3
4
5
6
7
Monday[8]= {8, 8, 8, 8, 8, 8, 8, 8, }
Thusday[8] = {8, 8, 4, 4, 7, 7, 8, 8, }
Wendsday[8] = {4, 4, 8, 7, 7, 8, 8, 8}
Thursdau[8] = { 8, 2, 2, 8, 8, 8, 8}
Friday[8] = {8, 7, 6, 5, 0, 3, 2, 1 }
Sonday[8] = {0, 0, 0, 0, 0, 0, 0, 0}
Satrday[8] = {8, 8, 8, 4, 4, 4, 2 , 2}

Did you make spelling mistakes on purpose?
This should be :
1
2
3
4
5
6
7
Monday[8]= {8, 8, 8, 8, 8, 8, 8, 8, }
Tuesday[8] = {8, 8, 4, 4, 7, 7, 8, 8, }
Wednesday[8] = {4, 4, 8, 7, 7, 8, 8, 8}
Thursday[8] = { 8, 2, 2, 8, 8, 8, 8}
Friday[8] = {8, 7, 6, 5, 0, 3, 2, 1 }
Sunday[8] = {0, 0, 0, 0, 0, 0, 0, 0}
Saturday[8] = {8, 8, 8, 4, 4, 4, 2 , 2}
Last edited on
Sorry I cant speak English well.
Do you know hard is talk in English whe its nor your Native Language ?.
And yes that how it is.
Jakubaz, please don't worry about your English, I think you are making yourself understood well enough. More important is how to use C++, and that can be hard for anyone, to begin with.
And I dont know how to write for thath code.
I thought by if but that will be 49 if.

I think instead of using many if statements, you should use a loop.
Do you know how to write a for-loop , that should be useful.

Also, you might use functions to simplify the processing, or even - perhaps a 2D array.

1
2
3
4
5
6
7
8
9
10
11
for (int i =0; i < velikost2; i ++)
    {
        int x = 0;
        if (cas[i].Pondeli_Hodiny > 0) { x = x +1;}
        if (cas[i].Uteri_Hodiny > 0) {x = x +1;}
        if (cas[i].Streda_Hodiny > 0) {x = x +1;}
        if (cas[i].Ctvrtek_Hodiny > 0) {x = x +1;}
        if (cas[i].Patek_Hodiny > 0) {x = x +1;}
        if (cas[i].Sobota_Hodiny > 0) {x = x +1;}
        if (cas[i].Nedele_Hodiny > 0) {x = x +1;}
        Den[i] = x;


Done
Topic archived. No new replies allowed.