Sabtu, 23 April 2011

TUGAS 5


Skrip c++
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
#include <string.h>
//Nama: Wahyu Lestari//Kelas: 12.1a.03//NIM: 12111146//No. Absen: 38//
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<<"\t\t\t ** GEROBAK FRIED CHICKEN **\n";
cout<<"\t------------------------------------------------------------\n";
cout<<"\t\t\t Kode Jenis Harga\n";
cout<<"\t------------------------------------------------------------\n";
cout<<"\t\t\t [D] Dada  Rp. 2500\n";
cout<<"\t\t\t [P] Paha  Rp. 2000\n";
cout<<"\t\t\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\t** GEROBAK 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();
}

Hasil Output
Jika Anda ingin download, silakan klik link dibawah ini ,, garatiss lhoooo !!!

Kamis, 21 April 2011

TUGAS 4

Skrip C++

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

main ()
{
char nama [50], golongan, pendidikan, lanjut, ulangi;
long lembur, tunjab, tunpen, gapok, gatot;
float jamker;
clrscr();
cout<<"\t\t\t** PROGRAM HITUNG GAJI KARYAWAN **";
cout<<"\n===============================================================================";
cout<<"\nNama Karyawan       : ";gets(nama);
cout<<"Golongan Jabatan      : ";cin>>golongan;
cout<<"Pendidikan            : ";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();
}






TUGAS 3

Skrip C++

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main ()

{
char nama[20], *juara ;
int Nilai1, Nilai2, Nilai3, rata;
clrscr();
cout<<"\t\t\t** PROGRAM HITUNG NILAI RATA-RATA **\n";
cout<<"================================================================================\n";
cout<<"\tNama                 : ";gets(nama);
cout<<"\tNilai Pertandingan 1 : ";cin>>Nilai1;
cout<<"\tNilai Pertandingan 2 : ";cin>>Nilai2;
cout<<"\tNilai Pertandingan 3 : ";cin>>Nilai3;
cout<<endl;
rata = (Nilai1 + Nilai2 + Nilai3)/3;

            if(rata > 80)
            { juara = "1";}
            else
            if (rata > 75)
               { juara = "2";}
            else
            if (rata > 65)
            { juara = "3";}
            else
            {juara = "tidak menjadi juara";}


cout<<" Siswa yang bernama "<<nama<<endl;
cout<<"Memperoleh nilai rata-rata "<<rata<<" dan menjadi juara "<<juara<<endl;

getch();
}










TUGAS 2

/* Penggunaan Operasi Logika AND/OR */

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

main()
{
float A, B, C, K, L, M, D, E, F, G, H;
clrscr();
cout<<"\t\t\t* Masukkan Nilai A : ";cin>>A;
cout<<"\t\t\t^ Masukkan Nilai B : ";cin>>B;
cout<<"\t\t\t* Masukkan Nilai C : ";cin>>C;
cout<<"\t\t\t^ Masukkan Nilai K : ";cin>>K;
cout<<"\t\t\t* Masukkan Nilai L : ";cin>>L;
cout<<"\t\t\t^ Masukkan Nilai M : ";cin>>M;

//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<<"\t\t\t** Program Ekspresi AND/OR **"<<endl;
cout<<"================================================================================"<<endl;
cout<<"\t\tHasil dari D = (4+2>A&&B-2>3+2||B+2<=6+2) adalah : " <<D<<endl;
cout<<"\t\tHasil dari E = K+5<M||M<L&&2*M-L>0 adalah        : " <<E<<endl;
cout<<"\t\tHasil dari F = L+5<M||C*K<L&&2*K-L>0 adalah      : " <<F<<endl;
cout<<"\t\tHasil dari G = A*4<=3*M+B adalah                 : " <<G<<endl;
cout<<"\t\tHasil dari H = K+10>A&&L-2>4*C adalah            : " <<H<<endl;
cout<<endl;
getch();
}
 


Hasil Output

TUGAS 1


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

main()
{
char nama[50];
clrscr();
int keaktifan , tugas , ujian ,hasilkeaktifan , hasiltugas , hasilujian, hasil;
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();
}









Rabu, 13 April 2011

cpp if / else task

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main ()
{
char nama[20];
int tanding1, tanding2, tanding3, rata2;
clrscr();
cout<<"\t PROGRAM NILAI HITUNG RATA-RATA\n";
cout<<"\t ==============================\n";
cout<<"NAMA : ";gets(nama);
cout<<"Nilai Pertandingan 1 : ";cin>>tanding1;
cout<<"Nilai Pertandingan 2 : ";cin>>tanding2;
cout<<"Nilai Pertandingan 3 : ";cin>>tanding3;
cout<<endl;
rata2 = (tanding1 + tanding2 + tanding3)/3;
cout<<"Siswa yang bernama "<<nama<<endl;
cout<<"Memperoleh nilai rata rata "<<rata2;
cout<<" Menjadi ";

if(rata2 < 65)
{
cout<<"tidak juara";
}
if (rata2 > 80)
{
cout<<"Juara ke-1";
}
else
if (rata2 > 75)
{
cout<<"juara ke-2";
}
else
if (rata2 > 65)
{
cout<<"Juara ke-3";
}