#include <stdio.h>
#include <conio.h>
#include <windows.h>
void main()
{
float cash=5000, x; //Kullanıcının bankada 5000 tl parası bulunmaktadır.
char username[20];
int password=9090;
int option;
double account_number; //Kullanıcıdan transfer işlemi için istenilen hesap numarası
printf("Welcome To Çintaş Bank
");
printf("Please enter your username: ");
gets_s(username);
printf("Please enter your password: ");
scanf_s("%d", &password);
while(password!=9090)
{
printf("Wrong Password. Try again...
");
printf("Please enter your password: ", password); //Sifre kontrolü icin while yapısı kullanıldı.Sifre dogru girilmedigi sürece tekrar sorgulanıyor.
scanf_s("%d", &password); // count bilgisi konularak 3 defa vb. yanlış bilgi girildiğinde döngüden çıkılabilir.
if (password==9090)
{
break;
}
}
printf("The Password Is Matched...
");
printf("...The System Is Loading.Please Wait...
");
Sleep( 3000 ); //3 saniye bekleme süresi.
printf("MENU
");
printf("***************
");
printf("1-BALANCE
");
printf("2-DEPOSIT
");
printf("3-WITHDRAW
");
printf("4-MONEY ORDER
");
printf("5-EXIT
");
printf("***************
");
scanf_s("%d" ,&option);
while(option!=1 && option!= 2 && option!=3 && option!= 4 && option!= 5 ) //Sadece menudeki secenekler girilebilir.
{
printf("Please press 1,2,3,4 and 5...
");
Sleep(1000); //1 saniye bekleme süresi.
printf("MENU
");
printf("***************
");
printf("1-BALANCE
");
printf("2-DEPOSIT
");
printf("3-WITHDRAW
");
printf("4-MONEY ORDER
");
printf("5-EXIT
");
printf("***************
");
scanf_s("%d" ,&option);
}
switch (option)
{
case 1:
printf("Your Balance is 5000 TL
");
break;
case 2:
printf("Enter the amount of money: ");
scanf_s("%f" , &x);
while(x<0)
{
printf("You Can Not Enter A Negative Value...
"); //Negatif sayi kontrolü
printf("Enter the amount of money: ");
scanf_s("%f" , &x);
if(x>0)
{
break;
}
}
printf("New cash= %5.2f
", cash=cash+x);
break;
case 3:
printf("Enter the amount of money: ");
scanf_s("%f" , &x);
while(x>5000)
{
printf("Insufficient Funds...
"); //Bakiye kontrolü
printf("Enter the amount of money: ");
scanf_s("%f" , &x);
if(x<5000)
{
break;
}
}
printf("New cash= %5.2f
", cash=cash-x);
break;
case 4:
printf("Please enter a account number which is transfer to money:
");
scanf_s("%f",&account_number);
printf("Enter the amount of money:
");
scanf_s("%f", &x);
while(x>5000)
{
printf("Insufficient Funds...
");
printf("Enter the amount of money: ");
scanf_s("%f" , &x);
if(x<5000)
{
break;
}
}
printf("Transfer Is Completed...
");
printf("New cash= %5.2f
", cash=cash-x);
break;
case 5:
printf("Thanks For Choosing Çintaş Bank "); //Mesajı verdikten sonra 3 saniye bekler sonra sistem otomatik kapanır.
Sleep( 3000 );
return;
break;
default:
return;
break;
}
getch();
}