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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
float pay(float*hworked)
{
float fpay;
fpay=*hworked*40;
return fpay;
}
float tax(float *percent)
{
float per;
per=pay*.2;
return per;
}
float tpay(
struct userinfo{
char sname[50];
int sid;
char sjobT[50];
char sdept[50];
char semp[50];
int additionalPay;
int deductions;
int taxablePay;
int totalPay;
}info[100];
void employee1(){
printf("Employee name: ");
scanf("%s", &info[0].sname);
}
int main(int argc, char *argv[])
{
char user[10];
char ch[9];
int y,sent=0,count=1;
char upass[50];
char yn;
int n=0;
do //username / password
{
system("cls");
printf("Enter username: ");
scanf("%s",user);
printf("Enter password: ");
y=0;
do
{
ch[0]=getch();
if(ch[0]==13 || y==9)
{ upass[y]='\0';
break;
}
else
upass[y]=ch[0];
y++;
printf("*");
}
while(1);
if(strcmp(user,"Admin")==0 && strcmp(upass,"1234")==0)
{
system("color 2F");
printf("\n\nAccess Granted for Admin!\nPress any key to continue.");
system("pause>0");
system("cls");
int choose = 0;
while(choose != 1){
printf("What do you want to do:\n(0)List of Employee (1)Logout\n");
scanf("%d", &choose);
switch(choose){
case 0:
printf("---List of EMPLOYEES\n");
int i;
employee1();
break;
}
}
}
else if(strcmp(user,"Employee")==1 && strcmp(upass,"1234")==1)
{
system("color 9F");
printf("\n\nAccess Granted! for Employee\nPress any key to continue.");
system("pause>0");
system("cls");
sent = 1 ;
}
else
{
system("color 4f");
printf("\n");
printf("this is your %d time tried loging in out of 5",count);
printf("\n\nAccess Denied!\n");
printf("\nDo you want to try again? y/n: ");
scanf("%s",&yn);
if(yn=='y' || yn=='Y')
{
count++;
system("cls");
}
else if(yn=='n' || yn=='N' || yn!='y' || yn!='Y')
break;
}
}while(sent!=1 && count<6);
getch();
return 0;
}
| |