contoh borland c ++ bercabang

contoh soal

( input )

voucher Pulsa PD perkasa jaya

==========================

nama pembeli                           :(input)

pilihan proveder kartu                 :(input)

pilihan kode kartu                      :(input)

pilihan voucher kartu [25/50/100] :(input)

jumlah beli                                :(input)

===============================

 

oucher Pulsa PD perkasa jaya

==========================

Nama Pembeli :(ouput) 
Nama Provider : (ouput)
Jenis Kartu      : (ouput)
Harga              : (ouput)

Jumlah Beli      : (ouput)

============================
Total Bayar :

Bonus :
============================
Jumlah Bayar :;
Uang Bayar :
============================
Uang Kembali ;
============================
Terima Kasih Telah Belanja               :

 

jawaban nya

 

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
main()
{
char nm[20],pro,merk[20],jenis[5],najen[10],vouc[5],lagi;
int jumbel,harga,totbay,bon,jumbay,ubay,ukem;
clrscr();
atas:
cout<<“\t****Voucher Pulsa PD Perkasa Jaya****”<<endl;
cout<<“===============================================”<<endl;
cout<<“Jenis Kartu “<<endl;
cout<<“TELKOMSEL”<<endl;
cout<<“INDOSAT”<<endl;
cout<<“_______________”<<endl;
cout<<“Nama Pembeli : “;cin>>nm;
cout<<“Pilih Provider Kartu : “;cin>>pro;
cout<<“Pilih Jenis Kartu : “;cin>>jenis;
cout<<“Pilih Voucher Kartu [25|50|100] : “;cin>>vouc;

if(pro==’T’||pro==’t’)
{
{strcpy(merk,”Telkomsel”);}
if(!strcmp(jenis,”AS”)||!strcmp(jenis,”as”))
{
{strcpy(najen,”AS”);}
if(!strcmp(vouc,”25″))
{harga=26000;}
else
if(!strcmp(vouc,”50″))
{harga=51000;}
else
if(!strcmp(vouc,”100″))
{harga=95000;}
}
else
if(!strcmp(jenis,”SI”)||!strcmp(jenis,”si”))
{
{strcpy(najen,”SIMPATI”);}
if(!strcmp(vouc,”25″))
{harga=22000;}
else
if(!strcmp(vouc,”50″))
{harga=52000;}
else
if(!strcmp(vouc,”100″))
{harga=96000;}
}
}
else
if(pro==’I’||pro==’i’)
{
{strcpy(merk,”Indosat”);}
if(!strcmp(jenis,”M3″)||!strcmp(jenis,”m3″))
{
{strcpy(najen,”IM3″);}
if(!strcmp(vouc,”25″))
{harga=28000;}
else
if(!strcmp(vouc,”50″))
{harga=53000;}
else
if(!strcmp(vouc,”100″))
{harga=97000;}
}
else
if(!strcmp(jenis,”ME”)||!strcmp(jenis,”me”))
{
{strcpy(najen,”MENTARI”);}
if(!strcmp(vouc,”25″))
{harga=29000;}
else
if(!strcmp(vouc,”50″))
{harga=54000;}
else
if(!strcmp(vouc,”100″))
{harga=98000;}
}
}
cout<<“Jumlah Beli : “;cin>>jumbel;
cout<<“==============================================”<<endl;
totbay=harga*jumbel;
if(totbay>=100000)
{
bon=0.1*totbay;
}
else
{
bon=0;
}

clrscr();
cout<<“\tVoucher Pulsa PD Perkasa Jaya”<<endl;
cout<<“===============================================”<<endl;
cout<<“Nama Pembeli : “<<nm<<endl;
cout<<“Nama Provider : “<<merk<<endl;
cout<<“Jenis Kartu : “<<najen<<endl;
cout<<“Harga : “<<harga<<endl;
cout<<“Jumlah Beli : “<<jumbel<<endl;
cout<<“================================================”<<endl;
cout<<“Total Bayar :Rp. “<<totbay<<endl;
cout<<“Bonus :Rp. “<<bon<<endl;
cout<<“================================================”<<endl;
jumbay=totbay-bon;
cout<<“Jumlah Bayar :Rp. “<<jumbay<<endl;
cout<<“Uang Bayar :Rp. “;cin>>ubay;
cout<<“================================================”<<endl;
ukem=ubay-jumbay;
cout<<“Uang Kembali :Rp. “<<ukem<<endl;
cout<<“================================================”<<endl;
cout<<“\tTerima Kasih Telah Belanja”<<endl;
cout<<“\tDiToko Kami”<<endl;
cout<<“Mau Input Data Lagi Ya or tidak???”;cin>>lagi;
if(lagi==’Y’||lagi==’y’)
{goto atas;}
else
getch();
}

semoga berfaat buat kita,,,mari kita belajar bersama “Gambar

Tentang rachman92

orangnya sompel,lucu,gokil,norak,tidak memilik dalam berteman,
Pos ini dipublikasikan di Artikel. Tandai permalink.

Berikan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s