AL GORITMA TINGKAT MENENGAH
#include <iostream.h>
#include <conio.h>
main()
{
char nama[30];
int status,anak;
long int gaji_pokok, tunj_nikah, tunj_anak,gaji_bersih;
cout<<"\t Input Data\n";
cout<<" Nama Karyawan : ";
cin>>nama;
cout<<" Gaji Pokok : ";
cin>>gaji_pokok;
cout<<" Status Pernikahan\t\n";
cout<<" (1.Nikah, 2.Belum) [1/2] : ";
cin>>status;
if (status==1)
{
tunj_nikah=0.1*gaji_pokok;
cout<<" Jumlah Anak : ";
cin>>anak;
if (anak<2)
{
tunj_anak=0.05*gaji_pokok;
}
else
{
tunj_anak=0.1*gaji_pokok;
}
}
else if (status==2)
{
tunj_nikah=0;
}
else
{
cout<<" Anda Salah Memasukkan Kode\n";
}
gaji_bersih=gaji_pokok+tunj_nikah+tunj_anak;
cout<<"\n\t Input Data\n";
cout<<" Nama Karyawan : "<<nama<<endl;
cout<<" Gaji Pokok : Rp. "<<gaji_pokok<<endl;
cout<<" Tunjangan Nikah : Rp. "<<tunj_nikah<<endl;
cout<<" Tunjangan Anak : Rp. "<<tunj_anak<<endl;
cout<<" Gaji Bersih : Rp. "<<gaji_bersih<<endl;
getch();
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# include <iostream.h>
# include <conio.h>
main ()
{
cout<<"\n\t\t\t PT. Perusahaan Listrik Negara (PLN) \n";
cout<<"\t\t\t Pemasangan Baru Renkening Pelanggan\n";
gotoxy (5,5);
cout<<"-----------------------------------------------------------------------\n";
gotoxy (5,6); cout<<"| Kode ";
gotoxy (12,6); cout<<"| Jenis Pelanggan";
gotoxy (30,6); cout<<"| No.";
gotoxy (36,6); cout<<"| Sambungan";
gotoxy (59,6); cout<<"| Harga";
gotoxy (75,6); cout<<"|\n";
gotoxy (5,7);
cout<<"|---------------------------------------------------------------------|\n";
gotoxy (5,8); cout<<"| A.";
gotoxy (12,8); cout<<"| Rumah Tangga";
gotoxy (30,8); cout<<"| 1";
gotoxy (36,8); cout<<"| Dibawah 450 Watt";
gotoxy (59,8); cout<<"| Rp. 650.000";
gotoxy (75,8); cout<<"|\n";
gotoxy (5,9); cout<<"| ";
gotoxy (12,9); cout<<"| ";
gotoxy (30,9); cout<<"| 2";
gotoxy (36,9); cout<<"| 451 - 900 Watt";
gotoxy (59,9); cout<<"| Rp. 850.000";
gotoxy (75,9); cout<<"|\n";
gotoxy (5,10); cout<<"| ";
gotoxy (12,10); cout<<"| ";
gotoxy (30,10); cout<<"| 3";
gotoxy (36,10); cout<<"| 901 - 1.200 Watt";
gotoxy (59,10); cout<<"| Rp. 1.200.000";
gotoxy (75,10); cout<<"|\n";
gotoxy (5,11); cout<<"| ";
gotoxy (12,11); cout<<"| ";
gotoxy (30,11); cout<<"| 4";
gotoxy (36,11); cout<<"| 1.201 - 2.200 Watt";
gotoxy (59,11); cout<<"| Rp. 1.500.000";
gotoxy (75,11); cout<<"|\n";
gotoxy (5,12); cout<<"| ";
gotoxy (12,12); cout<<"| ";
gotoxy (30,12); cout<<"| 5";
gotoxy (36,12); cout<<"| 2.201 - 4.400 Watt";
gotoxy (59,12); cout<<"| Rp. 1.750.000";
gotoxy (75,12); cout<<"|\n";
gotoxy (5,13);
cout<<"|---------------------------------------------------------------------|\n";
gotoxy (5,14); cout<<"| B.";
gotoxy (12,14); cout<<"| Industri";
gotoxy (30,14); cout<<"| 6";
gotoxy (36,14); cout<<"| 4.401 - 9.500 Watt";
gotoxy (59,14); cout<<"| Rp. 2.250.000";
gotoxy (75,14); cout<<"|\n";
gotoxy (5,15); cout<<"|";
gotoxy (12,15); cout<<"|";
gotoxy (30,15); cout<<"| 7";
gotoxy (36,15); cout<<"| 9.501 - 12.000 Watt";
gotoxy (59,15); cout<<"| Rp. 2.750.000";
gotoxy (75,15); cout<<"|\n";
gotoxy (5,16); cout<<"|";
gotoxy (12,16); cout<<"|";
gotoxy (30,16); cout<<"| 8";
gotoxy (36,16); cout<<"| 12.001 - 16.000 Watt";
gotoxy (59,16); cout<<"| Rp. 3.250.000";
gotoxy (75,16); cout<<"|\n";
gotoxy (5,17); cout<<"|";
gotoxy (12,17); cout<<"|";
gotoxy (30,17); cout<<"| 9";
gotoxy (36,17); cout<<"| 16.001 - 22.000 Watt";
gotoxy (59,17); cout<<"| Rp. 4.500.000";
gotoxy (75,17); cout<<"|\n";
gotoxy (5,18); cout<<"|";
gotoxy (12,18); cout<<"|";
gotoxy (30,18); cout<<"| 10";
gotoxy (36,18); cout<<"| Diatas 22.001 Watt";
gotoxy (59,18); cout<<"| Rp. 6.750.000";
gotoxy (75,18); cout<<"|\n";
gotoxy (5,19);
cout<<"-----------------------------------------------------------------------\n";
getch();
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# include <iostream.h>
# include <conio.h>
main ()
{
int pilihan;
double alas, tinggi, segi3;
double panjang, lebar, lpp;
double jari2, luas_lingkaran;
cout<<" Masukkan Pilihan"<<endl;
cout<<"1. Menghitung Luas Segitiga"<<endl;
cout<<"2. Menghitung Luas Persegi Panjang"<<endl;
cout<<"3. Menghitung Luas Lingkaran"<<endl<<endl;
cout<<"Pilih (1/2/3) : ";
cin>>pilihan;
cout<<endl;
if (pilihan == 1)
{
cout<<"\t Menghitung Luas Segitiga \n";
cout<<"Masukkan Alas : ";
cin>>alas;
cout<<"Masukkan Tinggi : ";
cin>>tinggi;
segi3=0.5*alas*tinggi;
cout<<"Luas Segitiga = "<<segi3<<endl;
}
else if (pilihan==2)
{
cout<<"\t Menghitung Luas Persegi Panjang \n";
cout<<"Masukkan Panjang : ";
cin>>panjang;
cout<<"Masukkan Lebar : ";
cin>>lebar;
lpp=panjang*lebar;
cout<<"Luas Persegi Panjang = "<<lpp<<endl;
}
else if (pilihan==3)
{
cout<<"\t Menghitung Luas Lingkaran \n";
cout<<"Masukkan Jari-Jari : ";
cin>>jari2;
luas_lingkaran=3.14*(jari2*jari2);
cout<<"Luas Lingkaran = "<<luas_lingkaran<<endl;
}
else
{
cout<<"Maaf, Anda Salah Memilih"<<endl;
}
getch();
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# include <iostream.h>
# include <conio.h>
// Mendeklarasi fungsi utama
main()
{
// Deklarasi Variabel
char nama[30],jurusan[30],fakultas[30];
char nim[20];
// Inputan
cout<<"\t\tData Inputan"<<endl;
cout<<" Masukkan Nama Lengkap\t: ";
cin>>nama;
cout<<" Masukkan NIM\t\t: ";
cin>>nim;
cout<<" Masukkan Fakultas\t: ";
cin>>fakultas;
cout<<" Masukkan Jurusan\t: ";
cin>>jurusan;
//Output
cout<<endl<<"\tBiodata Mahasiswa"<<endl;
cout<<" Nama\t\t: "<<nama<<endl;
cout<<" NIM\t\t: "<<nim<<endl;
cout<<" Fakultas\t: "<<fakultas<<endl;
cout<<" Jurusan\t: "<<jurusan<< endl;
getch();
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Deklarasi Preprocessor dan processor
# include <iostream.h>
# include <conio.h>
main()
{
// Deklarasi Variabel
double nilai1,nilai2,bagi;
int jumlah,kurang,kali;
// Inputan
cout<<" Inputan Nilai"<<endl;
cout<<" Masukan Nilai 1 : ";
cin>>nilai1;
cout<<" Masukan Nilai 2 : ";
cin>>nilai2;
//proses
jumlah=nilai1+nilai2;
kurang=nilai1-nilai2;
kali=nilai1*nilai2;
bagi=nilai1/nilai2;
//Output
cout<<endl<<" Hasil Output"<<endl;
cout<<" Hasil "<<nilai1<<" + "<<nilai2<<" = "<<jumlah<<endl;
cout<<" Hasil "<<nilai1<<" - "<<nilai2<<" = "<<kurang<<endl;
cout<<" Hasil "<<nilai1<<" x "<<nilai2<<" = "<<kali<<endl;
cout<<" Hasil "<<nilai1<<" : "<<nilai2<<" = "<<bagi<<endl;
getch();
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# include <iostream.h>
# include <conio.h>
// Mendeklarasi fungsi utama
main()
{
// Deklarasi Variabel
char nama[30],jurusan[30],fakultas[30];
char nim[20];
// Inputan
cout<<"\t\tData Inputan"<<endl;
cout<<" Masukkan Nama Lengkap\t: ";
cin>>nama;
cout<<" Masukkan NIM\t\t: ";
cin>>nim;
cout<<" Masukkan Fakultas\t: ";
cin>>fakultas;
cout<<" Masukkan Jurusan\t: ";
cin>>jurusan;
//Output
cout<<endl<<"\tBiodata Mahasiswa"<<endl;
cout<<" Nama\t\t: "<<nama<<endl;
cout<<" NIM\t\t: "<<nim<<endl;
cout<<" Fakultas\t: "<<fakultas<<endl;
cout<<" Jurusan\t: "<<jurusan<< endl;
getch();
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <iostream.h>
#include <conio.h>
#include <string.h>
main()
{
int no,jd,flag;
char data[10][50],cari[10];
cout<<" Jumlah Data : ";
cin>>jd;
for (no=0;no<jd;no++)
{
cout<<" Data Ke-"<<no+1<<" : ";
cin>>data[no];
}
cout<<" Nilai Dicari : ";
cin>>cari;
for(no=0;no<jd;no++)
{
if (strcmp (data[no],cari)==0)
{
flag++;
}
}
if (flag!=0)
{
cout<<" Data Ditemukan, Berjumlah "<<flag<<" Buah"<<endl;
}
else
{
cout<<" Data Tidak Ditemukan"<<endl;
}
getch();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <iostream.h>
#include <conio.h>
main()
{
int no,jd,cari,flag,data[50];
cout<<" Jumlah Data : ";
cin>>jd;
for (no=0;no<jd;no++)
{
cout<<" Data Ke-"<<no+1<<" : ";
cin>>data[no];
}
cout<<" Nilai Dicari : ";
cin>>cari;
for(no=0;no<jd;no++)
{
if (data[no]==cari)
{
flag++;
}
}
if (flag!=0)
{
cout<<" Data Ditemukan, Berjumlah "<<flag<<" Buah"<<endl;
}
else
{
cout<<" Data Tidak Ditemukan"<<endl;
}
getch();
}
0 comments:
Post a Comment