Jumat, 17 Juni 2011

tugas 8

/*-----------------------------------*/
/*program dengan file header sendiri*/
/*----------------------------------*/
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include "hitnilai.h"
mulai()
awal
    int absen,tugas1,UTS1,UAS1,nilai,absensi,tugas2,UTS2,UAS2,nilaiakhir;
   hapus();
   warna(4);
   tampil("\nPROGRAM MENGHITUNG NILAI AKHIR MATA KULIAH\n");
   cout<<endl;
   cout<<"Masukkan Nilai Absensi : ";cin>>absen;
   cout<<"Masukkan Nilai Tugas : ";cin>>tugas1;
   cout<<"Masukkan Nilai U.T.S : ";cin>>UTS1;
   cout<<"Masukkan Nilai U.A.S : ";cin>>UAS1;
   absensi = absen*10/100;
   tugas2 = tugas1*20/100;
   UTS2 = UTS1*30/100;
   UAS2 = UAS1*40/100;
   nilaiakhir = absensi+tugas2+UTS2+UAS2;
   cout<<endl;
   cout<<"----------------------------------------------------";
   cout<<endl;
   cout<<"\tNilai Murni Absensi = "<<absen;
   cout<<" * 10% = "<<absensi<<endl;
   cout<<"\tNilai Murni Tugas = "<<tugas1;
   cout<<" * 20% = "<<tugas2<<endl;
   cout<<"\tNilai Murni U.T.S = "<<UTS1;
   cout<<" * 30% = "<<UTS2<<endl;
   cout<<"\tNilai Murni U.A.S = "<<UAS1;
   cout<<" * 40% = "<<UAS2;
   cout<<endl;
   cout<<"\tNilai Akhir yang diperoleh sebesar : "<<nilaiakhir;
   cout<<endl;
   cout<<"-----------------------------------------------------";
   tahan;
akhir


DOWN:OAD  jangan lupa buat dahulu headernya . .

tugas 7

#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>

main()
{
char namap[50], namak[50], tgl[50], lanjut, ulangi;
char *namab[9];
long hasat[9], jumhar[9], totbar[9];
long bayar, kembali;
int jumbel[9], kode[9] = {1,2,3,4,5,6,7,8,9};
int x, y, z = 0;
clrscr();
cout<<"\n\n\t\tNama Kasir = ";gets(namak);
cout<<"\n\n\t\tTanggal Login [dd/mm/yyyy] = ";gets(tgl);
cout<<"\n\n\t\tKasir saat ini "<<namak;
cout<<"\n\n\n\t\tPress Anykey To Countinue . . .";
lanjut = getche();
if(lanjut == 'Q')
    goto program;
else
    goto program;
program:
clrscr();
cout<<"\n\t\tMasukan Nama Pembeli = ";gets(namap);
cout<<"\t\tJumlah Data = ";cin>>y;
totbar[y] = 0;
    for (x = 1; x <= y; x++)
       {
      cout<<"\n\t\t----------------------";
       cout<<"\n\t\tData Ke-"<<x;
      cout<<"\n\n\t\tInput Kode Barang = ";cin>>kode[x];
          if(kode[x] == 1)
             {
            namab[x] = "Buku";
            hasat[x] = 3500;
            }
         else if (kode[x] == 2)
            {
            namab[x] = "Pensil";
             hasat[x] = 2000;
            }
         else if (kode[x] == 3)
             {
            namab[x] = "Pulpen";
            hasat[x] = 2500;
            }
         else if (kode[x] == 4)
             {
            namab[x] = "Penggaris";
            hasat[x] = 2500;
            }
         else if (kode[x] == 5)
             {
            namab[x] = "Serutan";
            hasat[x] = 2000;
            }
         else if (kode[x] == 6)
             {
            namab[x] = "Penghapus";
            hasat[x] = 2000;
            }
            else if (kode[x] == 7)
             {
            namab[x] = "Tipe-x";
            hasat[x] = 4000;
            }
            else if (kode[x] == 8)
             {
            namab[x] = "Spidol";
            hasat[x] = 5000;
            }
            else if (kode[x] == 9)
            {
            namab[x] = "Stabilo";
             hasat[x] = 3000;
            }
         else if (kode[x] < 1 || kode[x] > 9)
             {
            clrscr();
             cout<<"\n\t\tKode yang ada Masukan Salah.\n";
            cout<<"\n\t\tPress Anykey to Continue . . .";
            ulangi = getche();
                if (ulangi == 'Q')
                    goto program;
               else
                  goto program;
            }
      cout<<"\t\tAnda Memilih = "<<namab[x];
      cout<<"\n\t\tDengan Harga Satuan = "<<hasat[x]<<endl;
      cout<<"\t\tInput Jumlah Beli = ";cin>>jumbel[x];
      jumhar[x] = hasat[x] * jumbel[x];
      totbar[y] = totbar[y] + hasat[x] * jumbel[x];
      }
cout<<"\n\t\tAda Kesalahan? [Y/T] ";
ulangi = getche();
    if (ulangi == 'Y' || ulangi == 'y')
      goto program;
bill:
clrscr();
cout<<"\nKasir = "<<namak;
cout<<setiosflags(ios::right)<<setw(55)<<"No faktur : FN-00"<<z<<endl;
cout<<"Pembeli = "<<namap;
cout<<setiosflags(ios::right)<<setw(46)<<"Tanggal = "<<tgl<<endl;
cout<<"--------------------------------------------------------------------------------";
cout<<" No         Nama              Harga             Qty          Jumlah   \n";
cout<<"Unit       Barang            Satuan                               Harga    \n";
cout<<"--------------------------------------------------------------------------------";
   for(x = 1; x <= y; x++)
       {
      cout<<setiosflags(ios::left)<<setw(11)<<x;
      cout<<setiosflags(ios::left)<<setw(19)<<namab[x];
      cout<<setiosflags(ios::left)<<setw(19)<<hasat[x];
        cout<<setiosflags(ios::left)<<setw(17)<<jumbel[x];
        cout<<setiosflags(ios::left)<<setw(10)<<jumhar[x]<<endl;
      }
cout<<"--------------------------------------------------------------------------------\n";
cout<<setiosflags(ios::right)<<setw(66)<<"Total Bayar = "<<totbar[y]<<endl;
cout<<setiosflags(ios::right)<<setw(66)<<"Uang Bayar  = ";cin>>bayar;
    if(bayar >= totbar[y])
        kembali = bayar - totbar[y];
   else
       goto bill;
cout<<setiosflags(ios::right)<<setw(66)<<"Kembalian   = "<<kembali<<endl;
cout<<"\n\n--------------------------------------------------------------------------------";
cout<<"\n\t\t\t\tTERIMA KASIH";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n\nAnda Ingin Input Lagi? [Y/T] ";
ulangi = getche();
    if (ulangi == 'Y' || ulangi == 'y')
       {
      z++;
       goto program;
      }
   else
       goto akhir;
akhir:
getch();
}









tugas 6 c++

#include<constrea.h>
#include<stdio.h>
class jual
{
public:
char kode_hp[5],*merk_hp;
int jml_beli;
float harga,total;
};
main()
{
char nm_kasir[25],nm_pembeli[25];
int i,j;
float totbay;
jual hp[10];
clrscr();
cout<<" KONOHA CELL "<<endl;
cout<<" Jl. Kalibata Timur No.37 "<<endl;
cout<<" Telp. (021) 7901074 "<<endl;
cout<<"-------------------------------------------------------------"<<endl;
cout<<"Nama kasir : ";gets(nm_kasir);
cout<<"Nama pembeli : ";gets(nm_pembeli);
cout<<"Masukkan jumlah data : ";cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<"Data ke- "<<i<<endl;
cout<<"Kode Hp [NK66,SE80,NK73,SM73] :";cin>>hp[i].kode_hp;
if(strcmpi(hp[i].kode_hp,"NK66")==0)
{hp[i].merk_hp="Nokia 6600";
hp[i].harga=1200000;}
else
if(strcmpi(hp[i].kode_hp,"SE80")==0)
{hp[i].merk_hp="Sony Ericson W80";
hp[i].harga=1500000;}
else
if(strcmpi(hp[i].kode_hp,"NK73")==0)
{hp[i].merk_hp="Nokia N73";
hp[i].harga=1700000;}
else
if(strcmpi(hp[i].kode_hp,"SM73")==0)
{hp[i].merk_hp="Siemens C73";
hp[i].harga=1700000;}

DOWNLOAD