Diskusi Minggu 2

tugas diskusi kelompok
1. Diokta Fajri
2. Satrio Pandu S.
3. Fachrye Albar

#include <iostream>
#include <windows.h>
#include <conio.h>
#include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

void satuan(int x) {
if (x==1) cout<<"Satu ";
else if(x==2) cout<<"Dua ";
else if(x==3) cout<<"Tiga ";
else if(x==4) cout<<"Empat ";
else if(x==5) cout<<"Lima ";
else if(x==6) cout<<"Enam ";
else if(x==7) cout<<"Tujuh ";
else if(x==8) cout<<"Delapan ";
else if(x==9) cout<<"Sembilan ";
else if(x==10) cout<<"Sepuluh ";
else if(x==11) cout<<"Sebelas ";
}
void terbilang(long y)
{
if(y<=11) satuan(y);
else if((y>11) && (y<=19))
{
terbilang (y%10);
cout<<"Belas ";
}
else if ((y>=20)&&(y<=99))
{
terbilang(y/10);
cout<<"Puluh ";
terbilang(y%10);
}
else if((y>=100)&&(y<=199))
{
cout<<"Seratus ";
terbilang(y%100);
}
else if((y>=200)&&(y<=999))
{
terbilang(y/100);
cout<<"Ratus ";
terbilang(y%100);
}
else if((y>=1000)&&(y<=1999))
{
cout<<"Seribu ";
terbilang(y%1000);
}
else if((y>=2000)&&(y<=9999))
{
terbilang(y/1000);
cout<<"Ribu ";
terbilang(y%1000);
}
else if((y>=10000)&&(y<=99999))
{
terbilang(y/1000);
cout<<"Ribu ";
terbilang(y%1000);
}
else if((y>=100000)&&(y<=999999))
{
terbilang(y/1000);
cout<<"Ribu ";
terbilang(y%1000);
}
else if((y>=1000000)&&(y<=9999999))
{
terbilang((y/100000));
cout<<"Juta ";
terbilang((y%100000));
}
else if((y>10000000))
{
cout<<"eror";
}
}
int main(int argc, char** argv){
unsigned long nilai;
int tarik,setor,menu;
int saldo=40000000;
system ("cls");
char jawab;
menu:
system ("cls");
cout<<"|========================|"<<endl;
cout<<"|   Bank Mandiri\t |"<<endl;
cout<<"|------------------------|"<<endl;
cout<<"   Saldo Anda RP:"<<saldo<<endl;
cout<<"|------------------------|"<<endl;
cout<<"|    Menu Transaksi\t |"<<endl;
cout<<"|------------------------|"<<endl;
cout<<"|1. Ambil Tabungan\t |"<<endl;
cout<<"|2. Exit\t\t |"<<endl;
cout<<"|------------------------|"<<endl;
cout<<"     Pilih Menu 1/2 = ";cin>>menu;
if (menu==1){
system ("cls");
cout<<"|------------------------|"<<endl;
cout<<"|     Menu Penarikan |"<<endl;
cout<<"|------------------------|"<<endl;
cout<<"  Jumlah Penarikan = RP.";cin>>tarik;
saldo=saldo-tarik;
nilai=tarik;
system ("cls");
cout<<"Jumlah Saldo :RP. "<<saldo<<endl;
cout<<"Jumlah Penarikan RP. "<<tarik<<endl;cout<<"RP .";
terbilang(nilai);
cout<<"\nTransaksi Lagi (Y/T) =";
cin>>jawab;
while(jawab=='Y'||jawab=='y'){
goto menu;
}
system ("cls");
cout<<"Trima Kasih!!!";
}else {
system ("cls");
cout<<endl;
cout<<"Maaf Menu yang Anda Masukan Tidak Terdeteksi"<<endl;
cout<<"Apakah Anda Ingin Kembali ke Menu Transaksi (Y/T) =";
cin>>jawab;
while(jawab=='Y'||jawab=='y'){
goto menu;
}
system ("cls");
cout<<"Trima Kasih!!!";
}

return 0;
}

Komentar