Kamis, 26 Mei 2011

tugas 8

Buatlah program menghitung nilai akhir perkuliahan pada suatu mata kuliah , dengan ketentuan sebagai berikut :

                *Nilai Absensi * 10%

                * Nilai Tugas * 20%

                * Nilai U.T.S * 30%

                * Nilai U.A.S * 40%

Untuk proses penilaian dilakukan di dalam file header dan simpan nama file header tersebut hitnilai.h



Buatlah program header di bawah ini , kemudian  simpan dengan nama : hitnilai.h , pada folder kerja anda folder include


/*hitnilai.h

*/

#define awal {

#define akhir }

#define mulai() main()

#define cetak cout

#define tampil cprintf

#define masuk scanf

#define hapus() clrscr()

#define jika if

#define warna textcolor

#define tahan getche()


Simpan pada direktori C:\BC5\INCLUDE\..... , selanjutnya compile file hitnilai.h .


Buatlah program di bawah ini , kemudian gunakan header  yang sudah anda buat ..


/*-----------------------------------*/

/*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









nih ada di bawah. . . .

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();
}








 ada nih. . . . ? ? ?

Sabtu, 23 April 2011

tugas 6

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main()
{
char nama[50],jurusan[20],nim[8],kelas[10];
int absen,teori,praktek,ratarata;
cout<<"==========================================="<<endl;
cout<<"\tPROGRAM NILAI AKHIR PENJASKES"<<endl;
cout<<"==========================================="<<endl;
cout<<"NIM            = ";cin>>nim;
cout<<"Nama            = ";gets(nama);
cout<<"jurusan            = ";cin>>jurusan;
cout<<"nilai absen        = ";cin>>absen;
cout<<"nilai teori        = ";cin>>teori;
cout<<"nilai praktek        = ";cin>>praktek;
cout<<"============================================"<<endl;

ratarata= (absen+teori+praktek)/3;

                  if(ratarata>80)
                  {
                  cout<<"nilai akhir        = "<<ratarata<<endl;
                  cout<<"GRADE            = A\n";
                  cout<<"keterangan        = SANGAT BAIK";
                  }
                  else
                  if(ratarata>70)
                  {
                  cout<<"nilai akhir        = "<<ratarata<<endl;
                  cout<<"GRADE            = B\n";
                  cout<<"keterangan        = BAIK";
                  }
                  else
                  if(ratarata>60)
                  {
                  cout<<"nilai akhir         = "    <<ratarata<<endl;
                  cout<<"GRADE                = C\n";
                  cout<<"keterangan              = CUKUP";
                  }
                  else
                  {
                  cout<<"Nilai akhir    = "<<ratarata<<endl;
                  cout<<"GRADE    = D\n";
                  cout<<"keterangan    = KURANG";
                  }
cout<<endl;                 
cout<<"============================================"<<endl;
                  getch();
                  }

download aje bosss!!!

Jumat, 22 April 2011

tugas 5

#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
#include <string.h>
//Nama: rizki//Kelas: 12.1a.03//NIM: 12111309//No. Absen: 47//
main()
{
int x ,a ,ulangi;
char jenis[6] = {'D','d','P','p','S','s'} ,*ket[6];
long bapot[6], jumhar[6] = {0}, hasat[6] = {2500 ,2000 ,1500};
long jumbar[6]= {0}, pajak[6], totba[6];
pesan:
clrscr();
cout<<"\tGEROBAK FRIED CHICKEN\n";
cout<<"\t---------------------\n";
cout<<"\t Kode Jenis Harga\n";
cout<<"\t---------------------\n";
cout<<"\t [D] Dada  Rp. 2500\n";
cout<<"\t [P] Paha  Rp. 2000\n";
cout<<"\t [S] Sayap Rp. 1500\n\n";
cout<<"\t---------------------\n\n";
cout<<"\tBanyak Jenis : ";cin>>x;
jumbar[x] = 0;
    if (x <= 0)
   {
   cout<<"\n\t\tBanyak Jenis Tidak Boleh Null";
   goto akhir;
   }
   else
   {
        for(a = 1 ; a <= x; ++a)
       {
      cout<<"\tJenis Ke - "<<a;
        cout<<"\n\tJenis Potong [D/P/S] : ";cin>>jenis[a];
        cout<<"\tBanyak Potongan : ";cin>>bapot[a];
      cout<<"\t------------------------\n";
           if (jenis[a] == 'D' || jenis[a] == 'd')
             {
               ket[a] = "Dada ";
               hasat[a] = 2500;
            }
           else if (jenis[a] == 'P' || jenis[a] == 'p')
             {
            ket[a] = "Paha ";
               hasat[a] = 2000;
            }
           else if (jenis[a] == 'S' || jenis[a] == 's')
             {
            ket[a] = "Sayap";
               hasat[a] = 1500;
            }
           else
               {
              cout<<"\nAnda Salah Masukan Kode Jenis Potongan.";
              hasat[a] = 0;
              }
      jumhar[a] = hasat[a] * bapot[a];
      jumbar [x] = jumbar[x] + hasat[a] * bapot[a];
          if (jumbar[x] == 0)
             {
             pajak[x] = 0;
            totba[x] = 0;
            }
         else
             {
                pajak[x] = jumbar[x] * 0.1;
                totba[x] = jumbar[x] - pajak[x];
            }
      }
   }
cout<<"\n\n\tGEROBAK FRIED CHICKEN\n";
cout<<"------------------------------------------------\n";
cout<<"No.| Jenis     | Harga     | Banyak | Jumlah\n";
cout<<"   | Potong    | Satuan    | Beli   | Harga\n";
cout<<"================================================\n";
    for (a = 1; a <= x; ++a)
   {
    cout<<" "<<a<<" | "<<ket[a]<<"     | "<<hasat[a];
   cout<<"      | "<<bapot[a]<<"      | Rp. "<<jumhar[a]<<endl;
    }
cout<<"------------------------------------------------\n";
cout<<"\t\t\tJumlah Bayar  Rp. "<<jumbar[x]<<endl;
cout<<"\t\t\tPajak 10%     Rp. "<<pajak[x]<<endl;
cout<<"\t\t\tTotal Bayar   Rp. "<<totba[x];
cout<<"\n\n\tAnda Ingin Memesan Lagi? [Y/T] = ";
ulangi = getche();
    if (ulangi == 'Y' || ulangi == 'y')
       goto pesan;
   else
       cout<<"\n\n\t\tTerima Kasih";
akhir:
getch();
}

cari disini cooy

tugas 1

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

main()
{
char nama[50];
int keaktifan , tugas , ujian ,hasilkeaktifan , hasiltugas , hasilujian, hasil;
clrscr();
cout<<"\tPROGRAM NILAI AKHIR";
cout<<endl;
cout<<"^^^-------------------------------^^^"<<endl;
cout<<endl;
cout<<"\t\(^o^)/ siswa yang bernama: ";gets(nama);
cout<<"\t\(^o^)/ dengan nilai persentasi yang dihasilkan: \(^o^)/"<<endl;
cout<<endl;
cout<<"^^^-------------------------------^^^"<<endl;
cout<<"\tnilai keaktifan        :";cin>>keaktifan;
cout<<"\tnilai tugas        :";cin>>tugas;
cout<<"\tnilai ujian        :";cin>>ujian;
hasilkeaktifan = keaktifan * 20/100;
hasiltugas = tugas * 30/100;
hasilujian = ujian * 50/100;
hasil = hasilkeaktifan + hasiltugas + hasilujian;
cout<<endl;
cout<<"^^^-------------------------------^^^"<<endl;
cout<<endl;
cout<<"\tnilai keaktifan*20%    :"<<hasilkeaktifan<<endl;
cout<<"\tnilai tugas*30%        :"<<hasiltugas<<endl;
cout<<"\tnilai ujian*50%        :"<<hasilujian<<endl;
cout<<endl;
cout<<"^^^-------------------------------^^^"<<endl;
cout<<endl;
cout<<"\tjadi siswa yang bernama:"<<nama<<endl;
cout<<"\tmemperoleh nilai akhir sebesar :"<<hasil<<endl;
cout<<endl;
cout<<"^^^-------------------------------^^^"<<endl;
getch();
}
jgn lupa blajar dari sini

tugas 2 (and)

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

main()
{
char nama[15], kelas[20], nim[10];
float A, B, C, K, L, M, D, E, F, G, H;
clrscr();
cout<<"\tBIODATA SAYA\n";
cout<<"NIM        : "    ;cin>>nim;
cout<<"Nama        : "    ;gets(nama);
cout<<"Kelas        : "    ;cin>>kelas;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
cout<<"Nilai A = ";cin>>A;
cout<<"Nilai B = ";cin>>B;
cout<<"Nilai C = ";cin>>C;
cout<<"Nilai K = ";cin>>K;
cout<<"Nilai L = ";cin>>L;
cout<<"Nilai M = ";cin>>M;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
//proses
D = (4+2>A&&B-2>3+2||B+2<=6+2);
E = K+5<M||M<L&&2*M-L>0;
F = L+5<M||C*K<L&&2*K-L>0;
G = A*4<=3*M+B;
H = K+10>A&&L-2>4*C;

cout<<endl;
cout<<"program ekspresi AND/OR"<<endl<<endl;
cout<<"hasil dari D = (4+2>A&&B-2>3+2||B+2<=6+2) adalah " <<D<<endl;
cout<<"hasil dari E = K+5<M||M<L&&2*M-L>0 adalah " <<E<<endl;
cout<<"hasil dari F = L+5<M||C*K<L&&2*K-L>0 adalah " <<F<<endl;
cout<<"hasil dari G = A*4<=3*M+B adalah " <<G<<endl;
cout<<"hasil dari H = K+10>A&&L-2>4*C adalah " <<H<<endl;
cout<<endl<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
getch();
}
belajar dari sini

tugas 2 ( not)

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

main()
{
char nama[15], kelas[20], nim[10];
float A, B, C, K, L, M, D, E, F, G, H;
clrscr();
cout<<"\tBIODATA SAYA\n";
cout<<"NIM        :"    ;cin>>nim;
cout<<"Nama        :"    ;gets(nama);
cout<<"Kelas        :"    ;cin>>kelas;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
cout<<"\tNilai A =";cin>>A;
cout<<"\tNilai B =";cin>>B;
cout<<"\tNilai C =";cin>>C;
cout<<"\tNilai K =";cin>>K;
cout<<"\tNilai L =";cin>>L;
cout<<"\tNilai M =";cin>>M;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
//proses
D = !(4+2>A&&B-2>3+2||B+2<=6+2);
E = !(K+5<M||M<L&&2*M-L>0);
F = !(L+5<M||C*K<L&&2*K-L>0);
G = !(A*4<=3*M+B);
H = !(K+10>A&&L-2>4*C);

cout<<endl;
cout<<"\tprogram ekspresi NOT"<<endl<<endl;
cout<<"hasil dari D = (4+2>A&&B-2>3+2||B+2<=6+2) adalah" <<D<<endl;
cout<<"hasil dari E = K+5<M||M<L&&2*M-L>0 adalah" <<E<<endl;
cout<<"hasil dari F = L+5<M||C*K<L&&2*K-L>0 adalah" <<F<<endl;
cout<<"hasil dari G = A*4<=3*M+B adalah" <<G<<endl;
cout<<"hasil dari H = K+10>A&&L-2>4*C adalah" <<H<<endl;
cout<<endl<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
getch();
}
hasil nya plajarin disini okay!!!!

tugas 3

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main()
{
char nama[50];
int nilai1,nilai2,nilai3,ratarata;
cout<<"\t\tPROGRAM HITUNG NILAI RATA-RATA"<<endl;
cout<<"(^o^)/---------------------------------------------------------(^o^)/"<<endl;
cout<<endl;
cout<<"Nama                = ";gets(nama);
cout<<"nilai pertandingan I        = " ;cin>>nilai1;
cout<<"nilai pertandingan II        = " ;cin>>nilai2;
cout<<"nilai pertandingan III        = " ;cin>>nilai3;

ratarata= (nilai1+nilai2+nilai3)/3;

                  cout<<endl;
                  cout<<"siswa yang bernama "<<nama;
                  cout<<endl;
                  cout<<"memperoleh nilai rata-rata " <<ratarata;
                  cout<<endl;
                  cout<<"dan menjadi juara ke-";
                  if(ratarata>80)
                  {
                  cout<<"I";
                  }
                  else
                  if(ratarata>75)
                  {
                  cout<<"II";
                  }
                  else
                  if(ratarata>65)
                  {
                  cout<<"III";
                  }
                  else
                  cout<<"TIDAK JUARA";
                  cout<<" dari hasil perlombaan yang diikutinya"<<endl;
                  getch();
                  }
silahkan download programnya untuk mengetahui outputnya klik disini

tugas 4 c++

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

main ()
{
char nama [50], golongan, pendidikan, lanjut, ulangi;
long lembur, tunjab, tunpen, gapok, gatot;
int jamker;
clrscr();
cout<<"\tPROGRAM HITUNG GAJI KARYAWAN";
cout<<"\n============================================";
cout<<"\n\nNama Karyawan                  = ";gets(nama);
cout<<"Golongan Jabatan [1/2/3]          = ";cin>>golongan;
cout<<"Pendidikan [ (1)SMA/(2)D1/(3)D3/(4)S1    = ";cin>>pendidikan;
cout<<"Jumlah jam kerja               = ";cin>>jamker;
gapok = 300000;
cout<<"\nKaryawan Yang Bernama "<<nama;
    switch (golongan)
       {
      case '1':
          tunjab = gapok*0.05;
      break;
      case '2':
          tunjab = gapok*0.1;
      break;
      case '3':
            tunjab = gapok*0.15;
      break;
      default:
          tunjab = 0;
      }
   switch (pendidikan)
         {
         case '1':
             tunpen = gapok*0.025;

         break;
         case '2':
             tunpen = gapok*0.05;
         break;
         case '3':
             tunpen = gapok*0.2;
         break;
         case '4':
             tunpen = gapok*0.3;
         break;
         default:
             tunpen = 0;
         }
   if (jamker < 8 || jamker > 24)
       {
      lembur = 0;
      }
   else
       lembur = (jamker - 8)*3500;
gatot = tunjab + tunpen + lembur + gapok;
cout<<"\n\nHonor Yang Diterima";
cout<<"\n\tTunjangan Jabatan    Rp. "<<tunjab;
cout<<"\n\tTunjangan Pendidikan Rp. "<<tunpen;
cout<<"\n\tHonor Lembur         Rp. "<<lembur;
cout<<"\n\t                     --------------- +";
cout<<"\n\tGaji Total           Rp. "<<gatot;
getch();
}
hasil RUNnya coba sendiri y n kalau mw download klik disini