berikut ini adal program bank sederhanna
#include<iostream>
#include<stdlib.h>
#include<iomanip>
using namespace std;
struct nasabah
{
char nama[30];
long int norek;
double saldo;
};
int main()
{
int n=0;
nasabah nas[50];
int i,pil,x,pos;
long int no;
double setor,tarik;
bool ketemu=false;
menu:
system("cls");
cout<<"============================"<<endl;
cout<<"| Bank Kecil-Kecilan |"<<endl;
cout<<"============================"<<endl;
cout<<"| ' Menu Transaksi ' |"<<endl;
cout<<"| 1. Pendaftaran Nasabah |"<<endl;
cout<<"| 2. Penyetoran |"<<endl;
cout<<"| 3. Penarikan |"<<endl;
cout<<"| 4. Cetak Daftar Nasabah |"<<endl;
cout<<"| 5. Cari Nasabah |"<<endl;
cout<<"| 6. Keluar |"<<endl;
cout<<"============================"<<endl;
cout<<"Pilihan anda --> ";cin>>pil;
if (pil==1)
{
lagi:
cout<<endl;
cout<<"masukkan nomer rekening --> ";cin>>no;
for(i=0;i<n;i++)
{
if (no==nas[i].norek)
ketemu=true;
else
ketemu=false;
}
if (ketemu)
{
cout<<"nomor rekening tersebut sudah ada, ulangi lagi"<<endl;
goto lagi;
}
else
{
cout<<"masukkan nama anda --> ";cin>>nas[n].nama;
cout<<"masukkan saldo awal anda --> ";cin>>nas[n].saldo;
}
n=n+1;
nas[i].norek=no;
goto menu;
}
else if (pil==2)
{
cout<<endl;
cout<<"masukkan no rekening --> ";cin>>no;
for(i=0; i<n; i++)
{
if (no==(nas[i].norek))
{
pos=i;
ketemu=true;
break;
}
else
ketemu=false;
}
if (ketemu)
{
cout<<"masukkan jumlah setoran --> ";cin>>setor;
nas[pos].saldo=nas[pos].saldo+setor;
cout<<endl;
}
else
cout<<"nomor rekening tidak ditemukan"<<endl<<endl;
goto menu;
}
else if (pil==3)
{
cout<<endl;
cout<<"masukkan no rekening --> ";cin>>no;
for(i=0; i<n; i++)
{
if (no==(nas[i].norek))
{
pos=i;
ketemu=true;
break;
}
else
ketemu=false;
}
if (ketemu)
{
cout<<"masukkan jumlah penarikan --> ";cin>>tarik;
if (tarik<(nas[pos].saldo))
{
nas[pos].saldo=nas[pos].saldo-tarik;
cout<<endl;
}
else
cout<<"maaf saldo anda tidak mencukupi"<<endl;
}
else
cout<<"nomor rekening tidak ditemukan"<<endl<<endl;
goto menu;
}
else if (pil==4)
{
cout<<endl<<endl<<" DAFTAR NASABAH BANK"<<endl;
cout<<"|====|=================|==============|==============|"<<endl;
cout<<"| No | No Rekening | Nama | Total Saldo |"<<endl;
cout<<"|====|=================|==============|==============|"<<endl;
for(i=0;i<n;i++)
{
cout<<setw(4)<<i+1;
cout<<setw(17)<<nas[i].norek;
cout<<setw(14)<<nas[i].nama;
cout<<setw(14)<<((nas[i].saldo)+(nas[i].saldo*0.1))<<endl;
}
cout<<"|====|=================|==============|==============|"<<endl;
goto menu;
}
else if (pil==5)
{
cout<<endl<<"masukkan nomor rekening yang akan dicari --> ";cin>>no;
cout<<endl;
for(i=0; i<n; i++)
{
if (no==(nas[i].norek))
{
pos=i;
ketemu=true;
break;
}
else
ketemu=false;
}
if (ketemu)
{
cout<<"Nomor Rekening : "<<nas[pos].norek<<endl;
cout<<"Nama Nasabah : "<<nas[pos].nama<<endl;
cout<<"Saldo : "<<nas[pos].saldo<<endl;
cout<<"Total Saldo Setelah Bunga : "<<((nas[i].saldo)+(nas[i].saldo*0.1))<<endl<<endl;
}
else
cout<<"nomor rekening tidak ditemukan"<<endl<<endl;
goto menu;
}
else
{
cout<<endl<<"Terimakasih Telah Bertransaksi Disini . . ."<<endl<<endl;
}
}