Hi, some advice would be much appreciated.

So, I've got this assignment from university, the prof asked us to use the time function to record the clock in/out times of employees of a company using either fingerprint reader or clock cards.

Can anyone have a look and point out the mistakes?

also, does <time.h> record dates also?

thanks in advance. :)

PS: the names are totally random ;)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <time.h>
int main()
{
    FILE *f;
    int m,s,a[25]={4756,9870,5867,5241,2805,5490,4536,3458,3490,5666,1604,3045,1267,5766,2233,2938,3425,1837,6890,1029,7930,9348,2389,7689,3847},b;
    char* n[]={"Ah Fong Wan","Aisac","Alsong","Ayassamy","Balkins","Bilbo","Boudun","Britjones","Campbell","Carver","Granger","Jamina","Keiro","Kessaveeren","Liber","Litiktou","Lusting","Nasaraj","Nimov","Quenat","Riversdall","Sisitjuki","Soutsenjen","Waalia","Zaarian"};
    printf ("\t\t\t ADABPO ENGINEERING\n");
    printf ("ATTENDANCE SYSTEM\n\n");
    while(m!=1&&m!=2)
    {
    printf ("PRESS 1 FOR IDENTIFICATION\n");
    printf ("PRESS 2 FOR EXIT\n");
    scanf("%d",&m);
    if(m==1)
    {
    while(b!=a[0]&&b!=a[1]&&b!=a[2]&&b!=a[3]&&b!=a[4]&&b!=a[5]&&b!=a[6]&&b!=a[7]&&b!=a[8]&&b!=a[9]&&b!=a[10]&&b!=a[11]&&b!=a[12]&&b!=a[13]&&b!=a[14]&&b!=a[15]&&b!=a[16]&&b!=a[17]&&b!=a[18]&&b!=a[19]&&b!=a[20]&&b!=a[21]&&b!=a[22]&&b!=a[23]&&b!=a[24])
    {
    printf("Please enter your ID: ");
    scanf("%d",& b);
                if(b==a[0])
                {
                printf("Welcome Mr/Mrs");
                printf( "%s!\n",n[0]);
                }
                else if(b==a[1])
                printf("Welcome Mr/Mrs Aisac!\n");   
                else if(b==a[2])    
                printf("Welcome Mr/Mrs Alsong!\n");          
                else  if(b==a[3])
                printf("Welcome Mr/Mrs Ayassamy!\n");
                else if(b==a[4])
                printf("Welcome Mr/Mrs Balkins!\n");   
                else  if(b==a[5])
                printf("Welcome Mr/Mrs Bilbo!\n");               
                else  if(b==a[6])
                printf("Welcome Mr/Mrs Boudun!\n");
                else  if(b==a[7])
                printf("Welcome Mr/Mrs Britjones!\n");
                else  if(b==a[8])
                printf("Welcome Mr/Mrs Campbell!\n");
                else if(b==a[9])
                printf("Welcome Mr/Mrs Carver!\n");
                else if(b==a[10])
                printf("Welcome Mr/Mrs Granger!\n");
                else  if(b==a[11])
                printf("Welcome Mr/Mrs Jamina!\n");
                else  if(b==a[12])
                printf("Welcome Mr/Mrs Keiro!\n");
                else  if(b==a[13])
                printf("Welcome Mr/Mrs Kessaveeren!\n");
                else  if(b==a[14])
                printf("Welcome Mr/Mrs Liber!\n");
                else  if(b==a[15])
                printf("Welcome Mr/Mrs Litiktou!\n");
                else  if(b==a[16])
                printf("Welcome Mr/Mrs Lusting!\n");
                else if(b==a[17])
                printf("Welcome Mr/Mrs Nasaraj!\n");
                else if(b==a[18])
                printf("Welcome Mr/Mrs Nimov!\n");
                else if(b==a[19])
                printf("Welcome Mr/Mrs Quenat!\n");         
                else  if(b==a[20])
                printf("Welcome Mr/Mrs Riversdall!\n");         
                else if(b==a[21])
                printf("Welcome Mr/Mrs Sisitjuki!\n");         
                else if(b==a[22])
                printf("Welcome Mr/Mrs Soutsenjen!\n");         
                else if(b==a[23])
                printf("Welcome Mr/Mrs Waalia!\n");
                else if(b==a[24])
                printf("Welcome Mr/Mrs Zaarian!\n");
                else 
                {
                    printf("Unable to identify,please try again!!\n");    
                    }
                printf("PRESS 1 FOR ARRIVAL ATTENDANCE\n");
                printf("PRESS 2 FOR DEPARTURE ATTENDANCE\n");
                scanf("&d",&s);
                if(s==1)
                {
                        }
                if(s==2)
                {
                        }
                    }  
                    }
   if(m==2)
   {
          printf("");
          }
   else if(m!=1&&m!=2)
   {
   printf("INVALID SELECTION,PLEASE TRY AGAIN!\n");  
}
}    
   getch();
}
Last edited on
Hey. Could you edit your post and put your code between code tags, its under the format section <> - http://www.cplusplus.com/articles/jEywvCM9/
Can anyone have a look and point out the mistakes?


You tell us. Is it compiling? Are there errors? If so, what errors? Is it outputting wrong things? If so, what is it suppose to output? etc etc etc.
Last edited on
The thing is, i do not know how to write the program so that it records the time ins/outs and dates of each employees and then at the end of each day, week and month.

Basically, the employee fingerprints or uses magnetic card, the device recognises him/her, then presses 1 for arrival and 2 for departure. I've that part, but the rest is beyond me.

thanks in advance.
:)
Topic archived. No new replies allowed.