Program C++ Program Sales dan Bonus Array
#include <iostream.h>
#include <conio.h>
void main ()
{
int i;
int jmlsales
,ttlpnjualn[50],totalpenj=0,bonus[50],totbonus=0;
char sales[15][55];
cout<<"masukkan jumlah sales : ";
cin>>jmlsales;
cout<<"==============================================="<<endl;
cout<<"| NO | NAMA SALES | TOTAL PENJUALAN |"<<endl;
cout<<"==============================================="<<endl;
for (i=1; i<=jmlsales; i++)
{
gotoxy(3,4+i);
cout<<i;
gotoxy(1,4+i);
cout<<"|";
gotoxy(6,4+i);
cout<<"|";
gotoxy(29,4+i);
cout<<"|";
gotoxy(31,4+i);
cout<<"Rp.";
gotoxy(47,4+i);
cout<<"|";
gotoxy(8,4+i);
cin>>sales[i];
gotoxy(34,4+i);
cin>>ttlpnjualn[i];
totalpenj=totalpenj+ttlpnjualn[i];
}
gotoxy(1,4+i);
cout<<"==============================================="<<endl;
getch();
cout<<"NAMA SALES DAN BONUS"<<endl;
cout<<"============================================================"<<endl;
cout<<"| NO | NAMA SALES | TOTAL PENJUALAN | BONUS |"<<endl;
cout<<"============================================================"<<endl;
for (i=1; i<=jmlsales; i++)
{
gotoxy(3,9+i+jmlsales);
cout<<i;
gotoxy(1,9+i+jmlsales);
cout<<"|";
gotoxy(6,9+i+jmlsales);
cout<<"|";
gotoxy(29,9+i+jmlsales);
cout<<"|";
gotoxy(47,9+i+jmlsales);
cout<<"|";
gotoxy(31,9+i+jmlsales);
cout<<"Rp.";
gotoxy(60,9+i+jmlsales);
cout<<"|";
gotoxy(8,9+i+jmlsales);
cout<<sales[i];
gotoxy(34,9+i+jmlsales);
cout<<ttlpnjualn[i];
gotoxy(49,9+i+jmlsales);
cout<<"Rp.";
gotoxy (52,9+i+jmlsales);
{
if (ttlpnjualn[i]>=5000000)
bonus[i]=500000;
else if (ttlpnjualn[i]>=4000000)
bonus[i]=400000;
else if (ttlpnjualn[i]>=3000000)
bonus[i]=300000;
else if (ttlpnjualn[i]>=2000000)
bonus[i]=200000;
else if (ttlpnjualn[i]>=1000000)
bonus[i]=100000;
else
bonus[i]=0;
}
cout<<bonus[i];
totbonus=totbonus+bonus[i];
}
gotoxy(1,9+i+jmlsales);
cout<<"============================================================"<<endl;
gotoxy(1,10+i+jmlsales);
cout<<"|TOTAL";
gotoxy(29,10+i+jmlsales);
cout<<"|";
gotoxy(31,10+i+jmlsales);
cout<<"Rp.";
gotoxy(34,10+i+jmlsales);
cout<<totalpenj<<endl;
gotoxy(47,10+i+jmlsales);
cout<<"|";
gotoxy(49,10+i+jmlsales);
cout<<"Rp.";
gotoxy(52,10+i+jmlsales);
cout<<totbonus<<endl;
gotoxy(60,10+i+jmlsales);
cout<<"|"<<endl;
cout<<"============================================================"<<endl;
getch ();
}
Source: www.gatewan.com
0 Response to "Program C++ Program Sales dan Bonus Array"
Posting Komentar