-
Notifications
You must be signed in to change notification settings - Fork 0
/
finalformtry.c
89 lines (73 loc) · 1.91 KB
/
finalformtry.c
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
int main()
{
static const char PSWRD[]="1234";
char p[6];
int n=3, y;
int islem;
int bakiye =100;
int tutar;
printf("Welcome");
do{
printf("\n\nStudent_ID:Elif");
fflush(stdout);
printf("\nPassword:");
scanf("%s", p);
fflush(stdout);
y=strcmp(p, PSWRD);
if(y==0){
printf("\nSucessfull Login\n"); //succesfull login
printf("Islemler\nPara yatirmak icin 1 \nPara cekmek icin 2\nHesap bakiyenizi gormek icin 3\nCikmak icin 4 girimiz");
do{
printf("\n\nIslem Seciniz:");
scanf("%d",&islem);{
switch(islem){
case 1:
printf("Bakiyeniz %d \n",bakiye);
printf("\nYatirilacak Tutar:");
scanf("%d",&tutar);
bakiye += tutar;
printf("Bakiyeniz: %d",bakiye);
break;
case 2:
printf("Bakiyeniz %d \n",bakiye);
printf("\nCekilecek Tutar:");
scanf("%d",&tutar);
if (tutar > bakiye){
printf("Bakiye yetersiz\n");
}
bakiye -= tutar;
printf("Bakiyeniz: %d",bakiye);
break;
case 3:
printf("Bakiyeniz: %d",bakiye);
break;
case 4:
printf("Cikis Yapiliyor");
return 0;
default:
printf("Hatali Islem");
return 0;
}
} } while (islem);
return 0;
}
else{{
{
n--;
printf("\nWrong password, try again: "); //wrong password try again
printf("\nRemaining attempts ");
printf("%d\n", n);
getchar();
}
if(n<1){
printf("\nYour account has been blocked\n");
return 0;
}
}while (n>0);
return 0;