-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
147 lines (147 loc) · 4.21 KB
/
main.cpp
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
class bankaHesabi{
private:
string isimSoyisim;
double bakiye;
protected:
string sifreBelirleme;
string kullaniciSifre;
public:
bankaHesabi(string kullanici, double hesapBakiyesi):isimSoyisim(kullanici), bakiye(hesapBakiyesi)
{};
void paraYatir(double paraMiktari){
if (paraMiktari>0){
bakiye+=paraMiktari;
cout<<paraMiktari<<" basariyla hesabiniza yatirildi."<<endl;
cout<<"Guncel Hesap Bakiyesi: "<<bakiye<<endl;
}
}
void paraCek(double paraMiktari){
if (paraMiktari<=bakiye){
bakiye-=paraMiktari;
cout<<paraMiktari<<" basariyla hesabinizdan cekildi."<<endl;
cout<<"Guncel Hesap Bakiyesi: "<<bakiye<<endl;
} else{
cout<<"Yetersiz bakiye!"<<endl;
}
}
void bakiyeGoster(){
cout<<"Guncel Hesap Bakiyesi: "<<bakiye<<endl;
}
};
int main(){
string isimSoyisim;
string sifreBelirleme;
string kullaniciSifre;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "-";
}
cout << endl;
cout << "C++ Bankasina Hos Geldiniz\nLutfen isminizi, soyisminizi yazdiktan sonra sifrenizi belirleyiniz."<<endl;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "-";
}
cout << endl;
cout<<"Isim & Soyisim: ";
getline(cin,isimSoyisim);
cout << endl;
cout << "Sifrenizi belirleyin: ";
cin >> sifreBelirleme;
cout << endl;
if (sifreBelirleme.length() != 4) {
cout << "Lutfen 4 haneli bir sifre belirleyin."<<endl;
} else {
cout << "Sifreniz basariyla belirlendi.";
cout << endl;
}
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "-";
}
cout << endl;
int denemeHakki = 0;
const int denemeHakkiMaks=3;
while (denemeHakki<denemeHakkiMaks){
cout<<"Belirlediginiz sifreyi giriniz: ";
cin>>kullaniciSifre;
if (kullaniciSifre==sifreBelirleme){
cout << endl;
cout<<"Basariyla giris yaptiniz.";
cout << endl;
cout << endl;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "*";
}
for (char &buyukHarf : isimSoyisim) {
buyukHarf = toupper(buyukHarf);
}
cout << endl;
cout <<"Hos geldiniz "<<isimSoyisim<<endl;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "*";
}
cout << endl;
break;
} else {
cout<<"Hatali giris yaptiniz. Kalan sifre deneme hakki: "<<denemeHakkiMaks-denemeHakki-1<<endl;
denemeHakki++;
}
}
if (denemeHakki==denemeHakkiMaks){
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "-";
}
cout << endl;
cout << "3 hatali giris yaptiniz.\nSistem bloke edildi."<<endl;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "-";
}
return 0;
}
int secim;
double paraMiktari;
double bakiye;
bankaHesabi hesap(isimSoyisim,bakiye);
do {
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "*";
}
cout << endl;
cout<<"1- Para Yatir"<<endl;
cout<<"2- Para Cek"<<endl;
cout<<"3- Bakiyeyi Goster"<<endl;
cout<<"4- Cikis Yap"<<endl;
for(int cizgi = 0; cizgi < 50; cizgi++){
cout << "*";
}
cout << endl;
cout<<"Yapacaginiz islemi seciniz: ";
cin>>secim;
switch (secim) {
case 1:
cout << endl;
cout<<"Yatirilacak para miktari: ";
cin>>paraMiktari;
hesap.paraYatir(paraMiktari);
break;
case 2:
cout << endl;
cout<<"Cekilecek para miktari: ";
cin>>paraMiktari;
hesap.paraCek(paraMiktari);
break;
case 3:
hesap.bakiyeGoster();
break;
case 4:
break;
default:
cout << endl;
cout<<"Gecersiz secim!"<<endl;
break;
}
} while (secim!=4);
return 0;
}