-->

Wednesday, January 4, 2017

Assalammualaikum wr.wb.
Selamat malam semuanya pengunjung setia Syntax404, Saya berharap semua sehat sehat saja hehehe.
Sesuai dengan judul diatas "Cara Membuat Program Mesin ATM Sederhana Dengan C++" saya akan sedikit share tentang judul diatas baiklah kita simak sama sama ya :) .




Melihat screenshot diatas kayaknya tertarik kan hehehehe :D selow selow (kata anak sekarang) sebelum ke inti permasalahan nya coba cek dulu postingan yang lama tentang program C++ Cara membuat Program tiket Kereta Api dengan C++ 

Program ini adalah program ATM sederhana dengan menu cek saldo, tarik tunai, dan transfer, dan saya memakai header cuma 2 yaitu:
  1. #include<windows.h>
  2. #include <iostream>
 Yuk langsung saja kita praktekkan bersama lihat dan cermati script nya ya kawan :)
  • Buka c++ nya kemudian klik tab file->new->source file (jika anda tidak ada Dev-C++ nya Download Disini!!!
  • setelah itu copy script dibawah ini:

  •  // PROGRAM ATM SEDERHANA
     // SALDO UTAMA Rp5.000.000
     // PIN ANDA SAAT INI: 7777
    #include<windows.h>
    #include <iostream>
    using namespace std;
    long nSaldo = 5000000;  //global variabel


    int transaksi(int a, int b) //function utk menu tarik tunai
    {
        nSaldo= a-b;
        cout<<endl;
        cout<<"Transaksi berhasil !"<<endl<<endl;
        cout<<"Jumlah saldo anda saat ini adalah : Rp. "<<nSaldo<<endl<<endl;
        cout<<"1. Kembali"<<endl;
        cout<<"2. Keluar"<<endl<<endl;
         } //akhir function

    int main()
    {
        char cNama[50];
        int nPin, nTransfer;
        int nPil[7];
        char chRek[5];
     
        awal:
        system("cls");
               system("color 17");
        cout<<"SELAMAT DATANG DI ATM KITA KITA"<<endl<<endl;
        cout<<"Masukan PIN anda : "; cin>>nPin;
     
        if (nPin == 7777) //====>>> Ini adalah pin anda
        {
              
                 system("cls");
                 cout<<"\t \t \t \t===ATM KITA KITA==="<<endl<<endl;
                 cout<<"1. Cek Saldo"<<endl;
                 cout<<"2. Tarik Tunai"<<endl;
                 cout<<"3. Transfer"<<endl<<endl;
                 cout<<"Pilih menu : "; cin>>nPil[0];cout<<endl;
              
              
                 switch (nPil[0])    //Switch to case menu
                 {
                        case 1:      //Case menu 1
                             cout<<"Jumlah saldo anda saat ini adalah : Rp. "<<nSaldo<<endl<<endl;
                             cout<<"1. Kembali"<<endl;
                             cout<<"2. Keluar"<<endl<<endl;
                             cout<<"Pilih : "; cin>>nPil[2];
                             if (nPil[2] == 1)
                             {
                                         goto awal;
                                         }
                                         {
                                              break;
                                              }
                     
                        case 2:      //Case menu 2
                             cout<<"\t *_------------------_*"<<endl;
                             cout<<"\t || Menu Tarik Tunai ||"<<endl;
                             cout<<"\t *--------------------*"<<endl;
                             cout<<"\t | 1. |Rp. 50.000     |"<<endl;
                             cout<<"\t | 2. |Rp. 100.000    |"<<endl;
                             cout<<"\t | 3. |Rp. 200.000    |"<<endl;   
                             cout<<"\t | 4. |Rp. 500.000    |"<<endl;   
                             cout<<"\t | 5. |Rp. 1.000.000  |"<<endl;
                             cout<<"\t | 6. |Rp. 1.500.000  |"<<endl;
                             cout<<"\t | 7. |Rp. 2.000.000  |"<<endl;   
                             cout<<"\t | 8. |Rp. 3.000.000  |"<<endl;
                             cout<<"\t | 9. |Rp. 5.000.000  |"<<endl;
                             cout<<"\t *--------------------*"<<endl<<endl;
                             cout<<"Pilih : ";cin>>nPil[3];
                             switch (nPil[3]) //Sub case menu 2
                             {
                                    case 1:  //sub case menu 2 - 1
                                      
                                         transaksi(nSaldo, 100000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;;
                                                          }
                                              
                                              
                                    case 2:  //sub case menu 2 - 2
                                      
                                         transaksi(nSaldo, 200000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;;
                                                          }
                                 
                                    case 3:  //sub case menu 2 - 3
                                      
                                         transaksi(nSaldo, 500000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                    case 4:  //sub case menu 2 - 4
                                      
                                         transaksi(nSaldo, 1000000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                    case 5:  //sub case menu 2 - 5
                                      
                                         transaksi(nSaldo, 1500000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                    case 6:  //sub case menu 2 - 6
                                      
                                         transaksi(nSaldo, 2000000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                    case 7:  //sub case menu 2 - 7
                                      
                                         transaksi(nSaldo, 3000000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                    case 8:  //sub case menu 2 - 8
                                      
                                         transaksi(nSaldo, 5000000);
                                         cout<<"Pilih : ";cin>>nPil[4];
                                         if (nPil[4] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          goto akhir;
                                                          }
                                                       
                                                          }//Akhir sub case menu 2    
                                 
                     
                        case 3:     //Case menu 3
                          
                             ulang:
                             cout<<"Masukan nomor rekening (Max 5 digit): "; cin>>chRek;
                             cout<<"Masukan jumlah transfer      \t    : "; cin>>nTransfer; cout<<endl<<endl;
                             cout<<"Nomor rekening  : "<<chRek<<"\nJumlah transfer : "<<nTransfer<<endl<<endl;
                             cout<<"1. Transfer"<<endl;
                             cout<<"2. Ulangi"<<endl<<endl;
                             cout<<"Pilih : "; cin>>nPil[5];
                             if (nPil[5] == 1)
                             {
                                         cout<<endl;
                                         nSaldo = nSaldo - nTransfer;
                                         cout<<"Transaksi berhasil !"<<endl;
                                         cout<<"Jumlah saldo anda saat ini adalah : Rp. "<<nSaldo<<endl<<endl;
                                         cout<<"1. Kembali"<<endl;
                                         cout<<"2. Keluar"<<endl<<endl;
                                         cout<<"Pilih : "; cin>>nPil[6];
                                         if (nPil[6] == 1)
                                         {
                                                     goto awal;
                                                     }
                                                     {
                                                          break;
                                                          }
                                                          }
                                                          {
                                                                cout<<endl;
                                                                goto ulang;
                                                                }
                          
                          
                             } //Akhir case menu
                             }
                             {
                              cout<<"PIN anda salah !"<<endl<<endl;
                              cout<<"1. Kembali"<<endl;
                              cout<<"2. Keluar"<<endl<<endl;
                              cout<<"Pilih : "; cin>>nPil[1];
                              if(nPil[1] == 1)
                              {
                                         goto awal;
                                         }
                                         {
                                              goto akhir;
                                              }
                                              }
                                                             
                           
    akhir:              
    system("PAUSE");
    return 0;
     
    }
Setelah sudah di copas tekan F9 pada keyboad anda simpan dengan nama ATM, kalau berhasil seperti gambar dibawah ini:
Jika anda mauf file yang sudah jadi bisa anda download Dsini!!! password rar: "syntax404.tk" (Tanpa tanda kutip)
  • Catatan untuk program ATM
    PIN: 7777
Sekian tutorial dari saya semoga bermanfaat ya buat anda terutama pengunjung setia syntax404.tk, Saya ucapkan terimakasih buat yang sudah membaca dan mengikuti blog saya ini Assalammualaikum wr.wb, jangan lupa share, bookmark, dan comment dibawah ya :) sampai jumpa lagi di tutorail yang akan datang slalu tunggu ya update artikel menarik nya :)

Berkomentarlah Dengan Baik!
EmoticonEmoticon