Senin, 18 April 2011

tugas c++


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main()
{
char nmp[20],*nmk,kdkue;
int hrgk,jmlk,jumbay;
clrscr();
cout<<"nama pembeli :";cin>>nmp;
cout<<"kode kue (1/2/3/4) :";cin>>kdkue;
 cout<<endl;
 cout<<" daftar menu "<<endl;
 cout<<"   1. bolu black florest rp.60000\t"<<endl;
 cout<<"   2. chesee cake        rp.45000\t"<<endl;
 cout<<"   3. banana cake        rp.25500\t"<<endl;
 cout<<"   4. strawbery cake     rp.35000\t"<<endl;
 cout<<"-----------------------------------"<<endl;

 if (kdkue=='1')
 {
 nmk="bolu black florest";
 hrgk=60000;
  }
  else if(kdkue=='2')
  {
  nmk="chesee cake";
  hrgk=45000;
   }
   else if(kdkue=='3')
   {
   nmk="banana cake";
   hrgk=25500;
   }
   else
   {
   nmk="strawbery";
   hrgk=35000;

   }
   cout<<endl;
   cout<<"        toko kue nikmat  "<<endl;
   cout<<"        struk pembayaran "<<endl;

   cout<<"        kode kue :"<<kdkue<<endl;
   cout<<"        nama kue :"<<nmk<<endl;
   cout<<"        harga kue :"<<hrgk<<endl;
   cout<<"        jumlah beli :";cin>>jmlk;

   jumbay= hrgk * jmlk;
   cout<<"---------------------------------"<<endl;

   cout<<"         jumlah bayar :rp.  "<<jumbay<<endl;
   cout<<endl;
   cout<<"        terimakasih atas kunjunganya  "<<endl;
   getch();
   }
outputnya :