Kamis, 03 April 2014
Selasa, 01 April 2014
5.3 e-book chapter 5
langsung ke C++ nya ya
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int count_emp=0, number_emp;
double rate,pay,total_pay=0,hours;
cout<<"Enter number of employees> ";
cin>>number_emp;
while(count_emp<number_emp){
cout<<"Karyawan "<<count_emp+1<<endl;
cout<<"Hours> ";
cin>>hours;
cout<<"Rate> ";
cin>>rate;
pay= hours*rate;
cout<<"Pay is= $ "<< pay<<endl;
total_pay=total_pay+pay;
count_emp=count_emp+1;
}
cout<<"All employees processed"<<endl;
cout<<"Total payroll is " <<total_pay<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int count_emp=0, number_emp;
double rate,pay,total_pay=0,hours;
cout<<"Enter number of employees> ";
cin>>number_emp;
while(count_emp<number_emp){
cout<<"Karyawan "<<count_emp+1<<endl;
cout<<"Hours> ";
cin>>hours;
cout<<"Rate> ";
cin>>rate;
pay= hours*rate;
cout<<"Pay is= $ "<< pay<<endl;
total_pay=total_pay+pay;
count_emp=count_emp+1;
}
cout<<"All employees processed"<<endl;
cout<<"Total payroll is " <<total_pay<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
MENGHITUNG PEMBAYARAN DENGAN PERULANGAN (5.2)
IDE SOLUSI :
masalah: menghitung pembayaran dengan perulangan
DESKRIPSI:
menggunakan perulangan WHILE
C++ :

masalah: menghitung pembayaran dengan perulangan
DESKRIPSI:
menggunakan perulangan WHILE
C++ :

Langganan:
Postingan (Atom)