Advertisement
bayu1st

MATAUANG

Dec 10th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5. int uang;
  6. int pecahan(int tunai);
  7. void garis();
  8. int matauang[10]={100000,50000,20000,10000,5000,2000,1000,500,200,100};
  9. int main(){
  10.     system ("color 70");
  11.     garis();
  12.     cout << setw(42)<<"PROGRAM PENGHITUNG JUMLAH PECAHAN UANG"<<endl;
  13.     garis();
  14.     cout << endl;
  15.     cout << " Masukan Jumlah Uang Anda : ";cin>>uang;
  16.    
  17.     pecahan(uang);
  18.     cin.get();
  19. }
  20.  
  21. void garis(){
  22.     cout << "=============================================="<<endl;
  23. }
  24.  
  25. int pecahan(int tunai){
  26.     int jum;
  27.     garis();
  28.     cout << setw(10)<<"No"<<setw(17)<<"Pecahan"<<setw(17)<<"Jumlah"<<endl;
  29.     garis();
  30.     for (int i = 0 ; i<10; i++ ){
  31.         jum=tunai/matauang[i];
  32.         tunai=tunai-(matauang[i]*jum);
  33.         cout << setw(10)<<(i+1)<<setw(17)<<matauang[i]<<setw(17)<<jum<<endl;
  34.     }
  35.     return jum;
  36.    
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement