Archive for April 2012
Program Mencari Nilai Max, Min dan Rata-rata
By : Unknown//Program Mencari Nilai Max, Min dan Rata-rata
#include<cstdlib>
#include<iostream>
using namespace std;
int main(void)
{
int nilai,sum=0,max=0,min=0,i=1,jml_data;
double rata;
cout<<"Jumlah Data : ";cin>>jml_data;
cout<<"Masukan Nilai Ke-"<<i<<" : ";cin>>nilai;
i++;
max=nilai;
min=nilai;
sum=sum+nilai;
while(i<=jml_data)
{
cout<<"Masukan Nilai Ke-"<<i<<" : ";cin>>nilai;
if(nilai>max)
max=nilai;
if(nilai<min)
min=nilai;
sum=sum+nilai;
i++;
}
rata=(double)sum/jml_data;
cout<<"Nilai Terendah : "<<min<<endl;
cout<<"Nilai Tertinggi : "<<max<<endl;
cout<<"Rata-Rata : "<<rata<<endl;
system("PAUSE");
return 0;
}
#include<cstdlib>
#include<iostream>
using namespace std;
int main(void)
{
int nilai,sum=0,max=0,min=0,i=1,jml_data;
double rata;
cout<<"Jumlah Data : ";cin>>jml_data;
cout<<"Masukan Nilai Ke-"<<i<<" : ";cin>>nilai;
i++;
max=nilai;
min=nilai;
sum=sum+nilai;
while(i<=jml_data)
{
cout<<"Masukan Nilai Ke-"<<i<<" : ";cin>>nilai;
if(nilai>max)
max=nilai;
if(nilai<min)
min=nilai;
sum=sum+nilai;
i++;
}
rata=(double)sum/jml_data;
cout<<"Nilai Terendah : "<<min<<endl;
cout<<"Nilai Tertinggi : "<<max<<endl;
cout<<"Rata-Rata : "<<rata<<endl;
system("PAUSE");
return 0;
}
Tag :
Program,
Program Mencari Upah Mingguan Karyawan
By : Unknown
Berikut ini adalah program untuk mencari upah mingguan karyawan:
#include <cstdlib>
#include <conio.h>
#include <iostream>
using namespace std;
int main (void)
{
cout<<"*-------------------------------------*\n";
cout<<"Program Mencari Upah Mingguan Karyawan\n";
cout<<"*-------------------------------------*\n";
int jjk,jamlembur,upahtotal,upahkerjanormal,jamkerjanormal;
char nama[50],gol;
jamkerjanormal=48*1;
cout<<"Nama : ";cin>>nama;
cout<<"Jumlah Jam Kerja : ";cin>>jjk;
cout<<"Golongan : ";cin>>gol;
system("CLS");
if (gol=='a' || gol=='A')
{
upahkerjanormal=jamkerjanormal*6000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Karyawan Paruh Waktu"<<endl;
}
else
if (gol=='b' || gol=='B')
{
upahkerjanormal=jamkerjanormal*7000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Karyawan Kontrak / Crew"<<endl;
}
else
if (gol=='c' || gol=='C')
{
upahkerjanormal=jamkerjanormal*8000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Koordinator / Management Trainee"<<endl;
}
else
if (gol=='d' || gol=='D')
{
upahkerjanormal=jamkerjanormal*10000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Supervisor"<<endl;
}
else
{
upahkerjanormal=jamkerjanormal*0;
jamlembur=(jjk-jamkerjanormal)*0;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Golongan Tidak Terdaftar"<<endl;
}
cout<<"Nama : "<<nama<<endl;
cout<<"Upah : "<<upahtotal<<endl;
system ("PAUSE");
}
#include <conio.h>
#include <iostream>
using namespace std;
int main (void)
{
cout<<"*-------------------------------------*\n";
cout<<"Program Mencari Upah Mingguan Karyawan\n";
cout<<"*-------------------------------------*\n";
int jjk,jamlembur,upahtotal,upahkerjanormal,jamkerjanormal;
char nama[50],gol;
jamkerjanormal=48*1;
cout<<"Nama : ";cin>>nama;
cout<<"Jumlah Jam Kerja : ";cin>>jjk;
cout<<"Golongan : ";cin>>gol;
system("CLS");
if (gol=='a' || gol=='A')
{
upahkerjanormal=jamkerjanormal*6000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Karyawan Paruh Waktu"<<endl;
}
else
if (gol=='b' || gol=='B')
{
upahkerjanormal=jamkerjanormal*7000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Karyawan Kontrak / Crew"<<endl;
}
else
if (gol=='c' || gol=='C')
{
upahkerjanormal=jamkerjanormal*8000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Koordinator / Management Trainee"<<endl;
}
else
if (gol=='d' || gol=='D')
{
upahkerjanormal=jamkerjanormal*10000;
jamlembur=(jjk-jamkerjanormal)*3000;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Supervisor"<<endl;
}
else
{
upahkerjanormal=jamkerjanormal*0;
jamlembur=(jjk-jamkerjanormal)*0;
upahtotal=upahkerjanormal+jamlembur;
cout<<"Golongan Tidak Terdaftar"<<endl;
}
cout<<"Nama : "<<nama<<endl;
cout<<"Upah : "<<upahtotal<<endl;
system ("PAUSE");
}
Tag :
Program,
