Kamis, 26 Juni 2014

Contoh Program Menu Harga Toko C++



Source code:
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;

main()
{
char kopes,kepas, lagi;
char napes[20];
long harga=0,tobay;
float jutik;
awal:
system("cls");
puts("\tPROGRAM HARGA KAYU");
puts("\t UD.SANTOSA");
puts("---------------------------------------");
cout<<"Jenis kayu :"<<endl;
cout<<"\t1. Jati "<<endl;
cout<<"\t2. Kamper "<<endl;
cout<<"\t3. Meranti "<<endl;
cout<<"masukan Jenis Ukuran [JTI/KMP/MRT] :";cin>>kopes;
cout<<"Jenis Ukuran :"<<endl;
cout<<"\t1. 1 meter "<<endl;
cout<<"\t2. 2 meter "<<endl;
cout<<"\t3. 3 meter "<<endl;
cout<<"Pilih Ukuran [1/2/3] :";cin>>kepas;

if(kopes=='JTI')
{strcpy(napes,"Jati");
}
if(kepas=='1'){harga=1500000;
}
else if(kepas=='2'){harga=900000;
}
else harga=700000;

if(kopes=='KMP')
{strcpy(napes,"Kamper");
}
if(kepas=='1'){harga=1200000;
}
else if(kepas=='2'){harga=800000;
}
else harga=400000;

if(kopes=='MRT')
{strcpy(napes,"Meranti");
}
if(kepas=='1'){harga=1000000;
}
else if(kepas=='2'){harga=700000;
}
else harga=300000;

cout<<"Harga\t:"<<harga<<endl;
cout<<"Jumlah yang di beli\t:";cin>>jutik;
tobay=harga*jutik;
cout<<"Total Bayar\t:"<<tobay<<endl;
puts("\t*****Matur suwun*****\n");
cout<<"Ingin Beli Lagi? [Y/N]:";cin>>lagi;

if(lagi=='Y'||lagi=='y')
goto awal;
else
getch();
}

Tidak ada komentar:

Posting Komentar