Pages

Rabu, 28 Desember 2011

GAJI [TUGAS]

  • GAJI PEGAWAI
  • #include 
    #include 
    #include 
    #include 
    
    void main(){
    
    char nama[20][20], nip[20][20];
    float gp[20],bonus[20],total[20];
    int i,a,lk[20];
    
    cout << " banyak data : "; cin >> a;
    for (i=1; i<=a; i++){
    clrscr();
    cout << " NIP  : " ; cin >> nip[i];
    cout << " Nama : " ; cin >> nama[i];
    cout << " Gaji Pokok : " ; cin >> gp[i];
    cout << " Lama Kerja (bulan) : " ; cin >> lk[i];
    
     if (lk[i] >= 24  )
     bonus[i] = (gp[i]*0.25);
     else
     if (lk[i] < 24 && lk[i] >= 12)
     bonus[i] = (gp[i]*0.15);
     else
     if (lk[i] < 12 && lk[i] >= 6)
     bonus[i] = (gp[i]*0.1);
     else
     bonus[i] = (gp[i]*0.05);
    
     total[i]=gp[i]+bonus[i];
    } textcolor(4);
      clrscr();
     printf("  -----------------------------------------------------------------------------\n");
      cprintf("    NIP     NAMA       GAJI POKOK     LAMA KERJA      BONUS         TOTAL");
     printf("\n  -----------------------------------------------------------------------------\n");
       for (i=1; i<=a; i++){
       gotoxy(5,i+3);cout << nip[i];
       gotoxy(13,i+3);cout << nama[i];
       gotoxy(24,i+3);printf("%10.2f %10d %16.2f %14.2f \n",gp[i],lk[i],bonus[i],total[i]);
       }
       printf("  -----------------------------------------------------------------------------\n");
    getch();
    }
    
Print Friendly and PDF

Artikel Terkait:

0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...