#include
#include
#include
#include //header untuk manipulasi (array)
garis()
{cout<<”\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3″<
gariss()
{cout<<”\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4″<
main()
{
struct
{char kd[10], nm[20], pak[30];
float hrg, stock;}
menu[30]; //fungsi struct
char hr[10],nmks[20];
int i,j,ts,ths;
ts=0;
ths=0;
clrscr();
cout<<”\t INPUT DATA BARANG”<
cout<<”\t ‘Rumah Makan Enak’”<
garis(); //pemanggilan fungsi function
cout<<”Hari Mencatat: “;cin>>hr;
cout<<”Nama Pencatat: “;cin>>nmks;
cout<<”Jumlah Data di Input: “;cin>>j;
garis();
clrscr();
for(i=1;i<=j;i++) // fungsi array
{
cout<
cout<<”Data ke – :”<
cout<<”Masukan Kode Makanan [A/B/C]: “;cin>>menu[i].kd;
cout<<”Jumlah Stock: “;cin>>menu[i].stock;
if (!strcmp(menu[i].kd,”a”)||!strcmp(menu[i].kd,”A”)) //fungsi if majemuk
{strcpy(menu[i].nm,”Nasgor + Ayam”);
strcpy(menu[i].pak,”Paket A”);
menu[i].hrg=50000;}
else if (!strcmp(menu[i].kd,”b”)||!strcmp(menu[i].kd,”B”))
{strcpy(menu[i].nm,”Nasgor + Bakso”);
strcpy(menu[i].pak,”Paket B”);
menu[i].hrg=15000;}
else if (!strcmp(menu[i].kd,”c”)||!strcmp(menu[i].kd,”C”))
{strcpy(menu[i].nm,”Nasgor + Udang”);
strcpy(menu[i].pak,”Paket C”);
menu[i].hrg=35000;}
cout<
gariss();
} //penutup fungsi array
clrscr();
cout<<”\t\t DAFTAR STOCK MENU”<
cout<<”\t ‘RUMAH MAKAN ENAK BANGET’”<
cout<<”\t Hari Input: “<
cout<<”\t Nama Kasir: “<
garis();
cout<<”No. Menu Satuan Harga Stock”<
cout<
garis();
for(i=1;i<=j;i++) //fungsi array
{
cout<
cout<
cout<
cout<
cout<
cout<
ts=ts + menu[i].stock;
ths=(menu[i].hrg*menu[i].stock)+ths;
} //penutup fungsi array
garis();
cout<<”Jumlah Stock: “<
cout<<”Jumlah Harga: “<
garis();
getch();
}
#include
#include
#include
garis()
{cout<<”\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3″<
{cout<<”\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4-\4″<
{
struct
{char kd[10], nm[20], pak[30];
float hrg, stock;}
menu[30]; //fungsi struct
char hr[10],nmks[20];
int i,j,ts,ths;
ts=0;
ths=0;
clrscr();
cout<<”\t INPUT DATA BARANG”<
cout<<”Hari Mencatat: “;cin>>hr;
cout<<”Nama Pencatat: “;cin>>nmks;
cout<<”Jumlah Data di Input: “;cin>>j;
garis();
clrscr();
for(i=1;i<=j;i++) // fungsi array
{
cout<
cout<<”Jumlah Stock: “;cin>>menu[i].stock;
if (!strcmp(menu[i].kd,”a”)||!strcmp(menu[i].kd,”A”)) //fungsi if majemuk
{strcpy(menu[i].nm,”Nasgor + Ayam”);
strcpy(menu[i].pak,”Paket A”);
menu[i].hrg=50000;}
else if (!strcmp(menu[i].kd,”b”)||!strcmp(menu[i].kd,”B”))
{strcpy(menu[i].nm,”Nasgor + Bakso”);
strcpy(menu[i].pak,”Paket B”);
menu[i].hrg=15000;}
else if (!strcmp(menu[i].kd,”c”)||!strcmp(menu[i].kd,”C”))
{strcpy(menu[i].nm,”Nasgor + Udang”);
strcpy(menu[i].pak,”Paket C”);
menu[i].hrg=35000;}
cout<
} //penutup fungsi array
clrscr();
cout<<”\t\t DAFTAR STOCK MENU”<
cout<<”\t Nama Kasir: “<
cout<<”No. Menu Satuan Harga Stock”<
for(i=1;i<=j;i++) //fungsi array
{
cout<
ths=(menu[i].hrg*menu[i].stock)+ths;
} //penutup fungsi array
garis();
cout<<”Jumlah Stock: “<
getch();
}
#include
#include
#include
#define perkalian (a*b)
#define penambahan (a+b)
#define pengurangan (a-b)
#define pembagian (a/b)
main()
{
float a,b;
float hsl;
a=0;
b=0;
char pil, lagi;
clrscr();
cout<<”Contoh Pembuatan Kalkulator Sederhana”<
cout<<”Menggunakan C++ \n”;
cout<<”———————————————–”<
cout<
a:
cout<<”Pilihannya [+ , * , / , -] : “;cin>>pil;
cout<<”Angka Pertama = “;cin>>a;
cout<<”Angka Kedua = “;cin>>b;
if(pil==’+')
{hsl=penambahan;}
else if (pil==’*')
{hsl=perkalian;}
else if(pil==’/')
{hsl=pembagian;}
else if(pil==’-')
{hsl=pengurangan;}
clrscr();
cout<<”Hasilnya = “<
cout<<”Hitung lagi [Y/T] : “;cin>>lagi;
if (lagi==’Y'||lagi==’y')
goto a;
cout<<”\t\t .::Terima Kasih::.”<
cout<<”\t\t\t\t\t\t\t sponsor_by_benkz”<
getch();
}
#include
#include
#define perkalian (a*b)
#define penambahan (a+b)
#define pengurangan (a-b)
#define pembagian (a/b)
main()
{
float a,b;
float hsl;
a=0;
b=0;
char pil, lagi;
clrscr();
cout<<”Contoh Pembuatan Kalkulator Sederhana”<
cout<<”———————————————–”<
cout<<”Pilihannya [+ , * , / , -] : “;cin>>pil;
cout<<”Angka Pertama = “;cin>>a;
cout<<”Angka Kedua = “;cin>>b;
if(pil==’+')
{hsl=penambahan;}
else if (pil==’*')
{hsl=perkalian;}
else if(pil==’/')
{hsl=pembagian;}
else if(pil==’-')
{hsl=pengurangan;}
clrscr();
cout<<”Hasilnya = “<
if (lagi==’Y'||lagi==’y')
goto a;
cout<<”\t\t .::Terima Kasih::.”<
}
Tidak ada komentar:
Posting Komentar