Minggu, 06 Maret 2016

mengaplikasikan warung dengan memilih menu dan menghitung total pembeliannya

inputannya..
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int miyam(int a)
{
    int total;
    total=a*6000;
    return total;
}

int midok(int b)
{
    int total;
    total=b*7000;
    return total;
}

int mioleng(int c)
{
    int total;
    total=c*4000;
    return total;
}

int mibus(int d)
{
    int total;
    total=d*3000;
    return total;
}

int mitek(int e)
{
    int total;
    total=e*8000;
    return total;
}

int mijo(int f)
{
    int total;
    total=f*9000;
    return total;
}

int miyamgor(int g)
{
    int total;
    total=g*10000;
    return total;
}

void cetakgaris(int n)
{int i;
for(i=1;i<=n;i++)
cout<<"-";cout<<"\n";
}

main()
{
int a,b,c,d,e,f,g;
int pilihan;
cout<<"-=+(*_*)+=- warung serba mie man -=(*_*)=-"<<endl;
cout<<"\npilihan: "<<endl;
cout<<"1.mie ayam"<<endl;
cout<<"2.mie dok-dok"<<endl;
cout<<"3.mie oleng"<<endl;
cout<<"4.mie ebus"<<endl;
cout<<"5.mie tek-tek"<<endl;
cout<<"6.mie ijo"<<endl;
cout<<"7.mie ayam oleng"<<endl;
cout<<"masukkan pilihan : ";cin>>pilihan;
cetakgaris(20);
switch(pilihan)
{
    case 1:
        cout<<"Nama : mie ayam"<<endl;
        cout<<"Harga : 6000 "<<endl;
        cout<<"Jumlah : "; cin>>a;
        cetakgaris(20);
        cout<<"Total : 6000 x "<<a<<" = "<<miyam(a);
        break;
    case 2:
        cout<<"Nama : mie dok-dok"<<endl;
        cout<<"Harga : 7000 "<<endl;
        cout<<"Jumlah : "; cin>>b;
        cetakgaris(20);
        cout<<"Total : 7000 x "<<b<<" = "<<midok(b);
        break;
    case 3:
        cout<<"Nama : mie oleng"<<endl;
        cout<<"Harga : 4000 "<<endl;
        cout<<"Jumlah : "; cin>>c;
        cetakgaris(20);
        cout<<"Total : 4000 x "<<c<<" = "<<mioleng(c);
        break;
    case 4:
        cout<<"Nama : mie ebus"<<endl;
        cout<<"Harga : 3000 "<<endl;
        cout<<"Jumlah : "; cin>>d;
        cetakgaris(20);
        cout<<"Total : 3000 x "<<d<<" = "<<mibus(d);
        break;
    case 5:
        cout<<"Nama : mie tek-tek"<<endl;
        cout<<"Harga : 8000 "<<endl;
        cout<<"Jumlah : "; cin>>e;
        cetakgaris(20);
        cout<<"Total : 8000 x "<<e<<" = "<<mitek(e);
        break;
    case 6:
        cout<<"Nama : mie ijo"<<endl;
        cout<<"Harga : 9000 "<<endl;
        cout<<"Jumlah : "; cin>>f;
        cetakgaris(20);
        cout<<"Total : 9000 x "<<f<<" = "<<mijo(f);
        break;
    case 7:
        cout<<"Nama : mie ayam goreng"<<endl;
        cout<<"Harga : 10000 "<<endl;
        cout<<"Jumlah : "; cin>>g;
        cetakgaris(20);
        cout<<"Total : 10000 x "<<g<<" = "<<miyamgor(g);
        break;
    default:
        cout<<"Pilihan anda tidak ada"<<endl;
        break;
}
}
    //return 0;

hasilnya

0 komentar:

Posting Komentar

Posting Lebih Baru Posting Lama Beranda

Diberdayakan oleh Blogger.

About us

Formulir Kontak

Nama

Email *

Pesan *

Find Us On Facebook

Translate

Popular Posts

Video Of Day

About

TechClue

Techclue Is A Multi layout Style Blogger Template. You Can Use This Template For Education Site As Well As For Simple Magazine Sites. Techclue Is The Perfect Combination Of Design.We install Lots Of Features Like Responsive Layout, SEO Optimization Etc.

Join Our Community!

Popular Posts

Recent Posts

Popular Posts

 

Followers

 

Flickr Gallery

Templates by Nano Yulianto | CSS3 by David Walsh | Powered by {N}Code & Blogger