type="text/javascript">

Jumat, 28 Maret 2014

5.5 Using a for Statement in a Counting Loop

Program C++ nya :
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int a=0, b;
    float rate,pay, total_pay=0.0, hours;
   
    cout<<"enter number of employees = ";cin>>b;
   
    for(a=0;a<b;a+=1){
              
               cout<<"Hours = ";cin>>hours;
               cout<<"Rate = ";cin>>rate;
               pay=hours*rate;
               cout<<"Pay is = $ "<<pay<<endl;
              
               a=a+1;
               }
               cout<<"All employees processed"<<endl;
               cout<<"Total payroll is "<<total_pay<<endl;
              
              
    system("PAUSE");
    return EXIT_SUCCESS;
}

#Screenshotnya :

Tidak ada komentar:

Posting Komentar