Wednesday, 14 February 2018

Membuat Program Counter HP Menggunakan Bahasa Pemrograman C dan C++

  Zel Afriadi       Wednesday, 14 February 2018
JANGAN LUPA BACA BISMILLAH DULU GAN :D
Membuat Program Counter HP Bahasa Pemrograman C++

TauPintar.net - Siapa yang tidak kenal dengan counter HP yaitu tempat dimana kamu bisa membeli HP terutama nya, pulsa, Case HP dan Acessoris-Acessoris HP atau Smartphone lainnya. Nah, pada kesempatan kali ini kita akan membuat programnya, di program ini tersedia 4 case, yaitu.

1. Handphone
Pada case ini Terdapat informasi tentang handphone yaitu merek handphone, jenis handphone, stock, harga jumlah handphone yang tersedia di counter tersebut.

2. Kartu Internet
Pada Case ini terdapat informasi tentang Jenis kartu, Besar Kouta kartu internet, dan, kartu internet yang tersedia di counter tersebut dan harga.

3. Pulsa
Pada Case ini Terdapat informasi tentang Jenis pulsa, salo pulsa, dan harga.

4. Transaksi
Pada Case ini kamu bisa membeli apa yang tersedia di case-case informasi di atas, misalnya kamu ingin membeli handphone, berapa banyak yang akan kamu beli dan terdapat total jumlah yang akan kamu bayar.


Membuat Program Counter HP Menggunakan Pemrograman C++

Program ini di buat Oleh Lisa Ardella Putri Follow Instagramnya di @lisaardellaputri
Baik tanpa basa-basi lagi langsung aja masuk ke program nya.

1. Syntax Program
#include <windows.h> //untuk penggunaan gotoxy 
#include <iostream>
#include <conio.h>
#include <string.h>
#include <time.h> // untuk looping (tulisan berjalan)

using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void gotoxy(int x, int y){
 COORD coord;  // untuk penggunaan gotoxy
 coord.X = x;
 coord.Y = y;
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
void delay(unsigned int mseconds) // untuk looping (tulisan berjalan)
{
clock_t goal=mseconds+clock();
while(goal>clock());
}

int main(int argc, char** argv) {              
 int kode_pilihan;   // variabel yang digunakan
 int kode_brg;
 int kode,pilih;
 int hp;
 int cse;
 int ki;
 int ps;
 int hrg,jml_brg,total,jm;
 char nabar[20], nama_konsumen[25], noperator[20], nnohp[12];
 int nnominal,nbayar,pbayar;
 int a,n;
 
 struct{
  int k[20];
  int nh[20],jp[20],sp[20],hpp[20];
  
float byr,kmbl,tot; 
  int jmlh[20];
 }konter[5];
 float tb;
 char np[20];
 int m,i;
 char mad;
 mad= 'Y';
 while (mad == 'y' || mad == 'Y'){
 system("cls");

     for(m=1;m<20;m++)
 {
  delay(120);
  gotoxy(m-1,2);cout<<' ';
  gotoxy(m,2);cout<<" COUNTER SEJAHTERA ABADI PEKANBARU ";
  gotoxy(19,3);cout<<"=====================================";
  gotoxy(m,4);cout<<" JL.Purwodadi Indah No.27 Pekanbaru";
 }

 
 gotoxy(5,7);cout<<" Menyediakan berbagai barang, Seperti : \n";
 gotoxy(5,8);cout<<"1. HandPhone\n";
 gotoxy(5,9);cout<<"2. Case Handphone\n";
 gotoxy(5,10);cout<<"3. Kartu Internet\n";
 gotoxy(5,11);cout<<"4. Pulsa HandPhone\n";
 gotoxy(5,12);cout<<"5. Transaksi\n";
 
 gotoxy(5,15);cout<<" Silahkan Pilih Menu [1/2/3/4/5] : "; cin>kode_pilihan;
 
 switch(kode_pilihan){
  
  case 1:            //12345678123456123456
  system ("cls");
 gotoxy(12,3);cout<<"=========================================================="<<endl;
 gotoxy(12,4);cout<<"|   Merek Handphone  |   Jenis Handphone     |   Stock   |"<<endl;
 gotoxy(12,5);cout<<"=========================================================="<<endl;
 gotoxy(12,6);cout<<"|       OPPO         |    A37,F1S,A39,F1     |    100    |"<<endl;
 gotoxy(12,7);cout<<"=========================================================="<<endl;
 gotoxy(12,8);cout<<"|      SAMSUNG       |    J2Prime,j7Prime    |    100    |"<<endl;
 gotoxy(12,9);cout<<"=========================================================="<<endl;
 gotoxy(12,10);cout<<"|       ASUS         | Zenfone5,zenfone max3 |    100    |"<<endl;
 gotoxy(12,11);cout<<"=========================================================="<<endl;
 break;
 
  case 2:
  system ("cls");
 gotoxy(12,3);cout<<"=========================================================="<<endl;
 gotoxy(12,4);cout<<"|   Merek Handphone  |   Jenis Handphone     |   Stock   |"<<endl;
 gotoxy(12,5);cout<<"=========================================================="<<endl;
 gotoxy(12,6);cout<<"|       OPPO         |    A37,F1S,A39,F1     |    150    |"<<endl;
 gotoxy(12,7);cout<<"=========================================================="<<endl;
 gotoxy(12,8);cout<<"|      SAMSUNG       |    J2Prime,j7Prime    |    150    |"<<endl;
 gotoxy(12,9);cout<<"=========================================================="<<endl;
 gotoxy(12,10);cout<<"|       ASUS         | Zenfone5,zenfone max3 |    150    |"<<endl;
 gotoxy(12,11);cout<<"=========================================================="<<endl;
 break;
 
 case 3:
 system ("cls");
 gotoxy(15,3);cout<<"==================================================="<<endl;
 gotoxy(15,4);cout<<"| Jenis Kartu |     Besar Kuota       |   Stock   |"<<endl;
 gotoxy(15,5);cout<<"==================================================="<<endl;
 gotoxy(15,6);cout<<"|   INDOSAT   | 2GB,3GB,6GB,12GB,32GB |    1500   |"<<endl;
 gotoxy(15,7);cout<<"==================================================="<<endl;
 gotoxy(15,8);cout<<"|  TELKOMSEL  | 2GB,3GB,6GB,12GB,32GB |    1500   |"<<endl;
 gotoxy(15,9);cout<<"==================================================="<<endl;
 gotoxy(15,10);cout<<"|      XL     | 2GB,3GB,6GB,12GB,32GB |    1500   |"<<endl;
 gotoxy(15,11);cout<<"==================================================="<<endl;
 gotoxy(15,12);cout<<"|    AXIS     | 2GB,3GB,6GB,12GB,32GB |    1500   |"<<endl;
 gotoxy(15,13);cout<<"==================================================="<<endl;
 gotoxy(15,14);cout<<"|      3      | 2GB,3GB,6GB,12GB,32GB |    1500   |"<<endl;
 gotoxy(15,15);cout<<"==================================================="<<endl;
 break;
 
  case 4:
  system ("cls");
 gotoxy(15,3);cout<<"=========================="<<endl;
 gotoxy(15,4);cout<<"| Jenis Pulsa |  Saldo    |"<<endl;
 gotoxy(15,5);cout<<"=========================="<<endl;
 gotoxy(15,6);cout<<"|   5 RIBU    |  10 RIBU  |"<<endl;
 gotoxy(15,7);cout<<"=========================="<<endl;
 gotoxy(15,8);cout<<"|   10 RIBU   |  30 RIBU  |"<<endl;
 gotoxy(15,9);cout<<"=========================="<<endl;
 gotoxy(15,10);cout<<"|   20 RIBU   |  50 RIBU  |"<<endl;
 gotoxy(15,11);cout<<"=========================="<<endl;
 gotoxy(15,12);cout<<"|   50 RIBU   |  70 RIBU  |"<<endl;
 gotoxy(15,13);cout<<"=========================="<<endl;
 gotoxy(15,14);cout<<"|  100 RIBU   | 150 RIBU  |"<<endl;
 gotoxy(15,15);cout<<"=========================="<<endl;
 break;
  case 5:
  system ("cls");
 gotoxy(15,3);cout<<" Menyediakan berbagai barang, Seperti : \n";
 gotoxy(15,4);cout<<"1. HandPhone\n";
 gotoxy(15,5);cout<<"2. Case Handphone\n";
 gotoxy(15,6);cout<<"3. Kartu Internet\n";
 gotoxy(15,7);cout<<"4. Pulsa HandPhone\n";
 gotoxy(15,9);cout<<" Masukkan Kode Yang Ingin Anda Beli : ";cin>>kode;
 
  if (kode==1) {
 gotoxy(10,11);cout<<"==================================================================="<<endl;
 gotoxy(10,12);cout<<"| Kode | Merek Handphone  |   Jenis Handphone     |     Harga     |"<<endl;
 gotoxy(10,13);cout<<"==================================================================="<<endl;
 gotoxy(10,14);cout<<"|  1.  |       OPPO       |    A37,F1S,A39,F1     |    2000000    |"<<endl;
 gotoxy(10,15);cout<<"==================================================================="<<endl;
 gotoxy(10,16);cout<<"|  2.  |      SAMSUNG     |    J2Prime,j7Prime    |    4000000    |"<<endl;
 gotoxy(10,17);cout<<"==================================================================="<<endl;
 gotoxy(10,18);cout<<"|  3.  |      ASUS        | Zenfone5,zenfone max3 |    3000000    |"<<endl;
 gotoxy(10,19);cout<<"==================================================================="<<endl;
 
 gotoxy(15,22);cout<<"Apa Yang Ingin Anda Beli [1/2/3] :";cin>>pilih;
  if(pilih == 1) {
   hrg=2000000;
   gotoxy(15,23);cout<<"Harga :Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total :Rp. "<<total<<endl;
  }
  else if(pilih == 2) {
   hrg=4000000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
 }
  else if(pilih == 3) {
   hrg=3000000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
}
 else {
  gotoxy(15,23);cout<<"Kode Yang Anda Inputkan Salah"<<endl;
 }
  }
  
  if (kode==2) {
 gotoxy(15,11);cout<<"==================================================================="<<endl;
 gotoxy(15,12);cout<<"| Kode | Merek Handphone  |   Jenis Handphone     |     Harga     |"<<endl;
 gotoxy(15,13);cout<<"==================================================================="<<endl;
 gotoxy(15,14);cout<<"|  1.  |       OPPO       |    A37,F1S,A39,F1     |     10000     |"<<endl;
 gotoxy(15,15);cout<<"==================================================================="<<endl;
 gotoxy(15,16);cout<<"|  2.  |      SAMSUNG     |    J2Prime,j7Prime    |     15000     |"<<endl;
 gotoxy(15,17);cout<<"==================================================================="<<endl;
 gotoxy(15,18);cout<<"|  3.  |      ASUS        | Zenfone5,zenfone max3 |     20000     |"<<endl;
 gotoxy(15,19);cout<<"==================================================================="<<endl;
 gotoxy(15,22);cout<<"Apa Yang Ingin Anda Beli [1/2/3] :";cin>>pilih;
  if(pilih == 1) {
   hrg=10000;
   gotoxy(15,23);cout<<"Harga :Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total :Rp. "<<total<<endl;
  }
  else if(pilih == 2) {
   hrg=15000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
 }
  else if(pilih == 3) {
   hrg=20000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
}
 else {
  gotoxy(15,23);cout<<"Kode Yang Anda Inputkan Salah"<<endl;
 }
  }
  
  if (kode==3) {
 gotoxy(15,3);cout<<"=========================================================="<<endl;
 gotoxy(15,4);cout<<"| Kode | Jenis Kartu |     Besar Kuota       |   Harga   |"<<endl;
 gotoxy(15,5);cout<<"=========================================================="<<endl;
 gotoxy(15,6);cout<<"|  1.  |   INDOSAT   | 2GB,3GB,6GB,12GB,32GB |   100000  |"<<endl;
 gotoxy(15,7);cout<<"=========================================================="<<endl;
 gotoxy(15,8);cout<<"|  2.  |  TELKOMSEL  | 2GB,3GB,6GB,12GB,32GB |   50000   |"<<endl;
 gotoxy(15,9);cout<<"=========================================================="<<endl;
 gotoxy(15,10);cout<<"|  3.  |     XL     | 2GB,3GB,6GB,12GB,32GB |    52000   |"<<endl;
 gotoxy(15,11);cout<<"=========================================================="<<endl;
 gotoxy(15,12);cout<<"|  4.  |    AXIS    | 2GB,3GB,6GB,12GB,32GB |    60000   |"<<endl;
 gotoxy(15,13);cout<<"=========================================================="<<endl;
 gotoxy(15,14);cout<<"|  5.  |     3      | 2GB,3GB,6GB,12GB,32GB |    40000   |"<<endl;
 gotoxy(15,15);cout<<"=========================================================="<<endl;
 gotoxy(15,18);cout<<"Apa Yang Ingin Anda Beli [1/2/3/4/5] :";cin>>pilih;
  if(pilih == 1) {
   hrg=100000;
   gotoxy(15,19);cout<<"Harga :Rp. "<<hrg<<endl;
   gotoxy(15,20);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,22);cout<<"Total :Rp. "<<total<<endl;
  }
  else if(pilih == 2) {
   hrg=50000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
 }
  else if(pilih == 3) {
   hrg=52000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
}
 else if(pilih == 4) {
   hrg=60000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
 }
 else if(pilih == 5) {
   hrg=40000;
   gotoxy(15,23);cout<<"Harga : Rp. "<<hrg<<endl;
   gotoxy(15,24);cout<<"Berapa banyak ingin beli ?";cin>>jml_brg;
   total=hrg*jml_brg;
   gotoxy(15,26);cout<<"Total : Rp. "<<total<<endl;
  }
 else {
  gotoxy(15,23);cout<<"Kode Yang Anda Inputkan Salah"<<endl;
 }
  }
    if (kode==4) {
 gotoxy(15,11);cout<<"================================="<<endl;
 gotoxy(15,12);cout<<"| Kode | Jenis Pulsa |  Harga   |"<<endl;
 gotoxy(15,13);cout<<"================================="<<endl;
 gotoxy(15,14);cout<<"|  1.  |   5 RIBU    |    6000  |"<<endl;
 gotoxy(15,15);cout<<"================================="<<endl;
 gotoxy(15,16);cout<<"|  2.  |   10 RIBU   |   11000  |"<<endl;
 gotoxy(15,17);cout<<"================================="<<endl;
 gotoxy(15,18);cout<<"|  3.  |   20 RIBU   |   21000  |"<<endl;
 gotoxy(15,19);cout<<"================================="<<endl;
 gotoxy(15,20);cout<<"|  4.  |   50 RIBU   |   51000  |"<<endl;
 gotoxy(15,21);cout<<"================================="<<endl;
 gotoxy(15,22);cout<<"|  5.  |  100 RIBU   |  100000  |"<<endl;
 gotoxy(15,23);cout<<"================================="<<endl;  
 gotoxy(15,25);cout<<"Nama Konsumen : ";cin>>nama_konsumen;
 
 gotoxy(15,27);cout<<"Masukkan Jumlah pulsa yang akan di isi :";cin>>n;
 for(a=1;a<=n;a++)
{
 cout<<"Kode :";cin>>konter[a].k[a];
 cout<<"Jenis Pulsa :";cin>>konter[a].jp[a];
 cout<<"Harga Pulsa :";cin>>konter[a].hpp[a];
 cout<<"Jumlah isi :";cin>>konter[a].jmlh[a];
}
  system("cls");
 gotoxy(25,3);cout<<"Handphone";
                    // 12345678 10111213141516171819202122 26272829303132333435 37383940414243444546474849 51525354555657585960616263 6465666768697071727374757677
 gotoxy(5,5);cout<<"---------------------------------------------------------------"<<endl;
 gotoxy(5,6);cout<<"| Kode | Jenis Pulsa |    Harga    | Jumlah isi |   Total     |"<<endl;
 gotoxy(5,7);cout<<"---------------------------------------------------------------"<<endl;
 
 for(a=1;a<=n;a++)
{
 gotoxy(5,7+a);cout<<"|"; // dihitung dari garis terakhir ditabel
 gotoxy(8,7+a);cout<<a;
 gotoxy(12,7+a);cout<<"|";
 gotoxy(19,7+a);cout<<konter[a].jp[a];
 gotoxy(26,7+a);cout<<"|";
 gotoxy(33,7+a);cout<<konter[a].hpp[a];
 gotoxy(40,7+a);cout<<"|";
 gotoxy(46,7+a);cout<<konter[a].jmlh[a];
 gotoxy(53,7+a);cout<<"|";
 konter[a].tot=konter[a].hpp[a]*konter[a].jmlh[a];
 gotoxy(59,7+a);cout<<konter[a].tot;
 gotoxy(67,7+a);cout<<"|";
 tb=tb+konter[a].tot;
}
cout<<endl;
cout<<"     ---------------------------------------------------------------"<<endl;
cout<<endl;
  cout<<"Total Bayar :Rp. "<<tb<<endl;
  cout<<"Bayar       :Rp. ";cin>>konter[a].byr;
  konter[a].kmbl=konter[a].byr-tb;
  cout<<"Kembalian   :Rp. "<<konter[a].kmbl<<endl;}
    cout<<"\n\nApa Anda Ingin Mengulanginya (y/t) : ";cin>>mad;
    }
    
    for (i=5;i<31;i++)
    {
     delay(90);
     gotoxy(i-1,30);cout<<' ';
     gotoxy(i,30);cout<<" TERIMA KASIH DATANG KEMBALI ";
 }
    

    getch ();
}
}
Pastekan Syntax di atas di Dev atau Turbo C, lalu Compile dan run

Note :
Pahami setiap perintah yang ada pada  Syntax di atas

Sekian Cara Membuat Program Counter HP Menggunakan Bahasa Pemrograman C dan C++ semoga bermanfaat dan menambah pengetahuan kamu.
(zac)

Baca Juga :
Membuat Program Sistem Online Shop Menggunakan Bahasa Pemrograman C dan C++
Membuat Program Layanan Objek Wisata Menggunakan Bahasa Pemrograman C dan C++
logoblog

Thanks for reading Membuat Program Counter HP Menggunakan Bahasa Pemrograman C dan C++

Previous
« Prev Post

No comments:

Post a Comment

Silahkan beri komentar dengan bijak dan sesuai dengan topik artikel.
Gunakan tombol balas dibawah komentar terkait jika ingin membalas komentar agar komunikasi lebih terstruktur.
Klik untuk melihat kode :) :( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @-@ :-a :W *fck* :ngakak |o| :goodluck :smile

Follow & Dapatkan Artikel Terbaru Dari TauPintar Blog