program pemecah uang C++

program pemecah uang C++ (kasus 7 bab 3 diktat alpro)


#include<iostream>
using namespace std;
int main()
{
    long uang,sisa;
    int u100rb,u50rb,u20rb;
    int u10rb,u5rb,u2rb,u1rb,u5ratus;
    cout<<"    Program Memecah Uang   "<<endl;
    cout<<"----------------------------------------"<<endl;
    cout<<"Input jumlah uang --> ";cin>>uang;
  
    u100rb=uang/100000;
    sisa=uang%100000;
  
    u50rb=sisa/50000;
    sisa=sisa%50000;
  
    u20rb=sisa/20000;
    sisa=sisa%20000;
  
    u10rb=sisa/10000;
    sisa=sisa%10000;
  
    u5rb=sisa/5000;
    sisa=sisa%5000;
  
    u2rb=sisa/2000;
    sisa=sisa%2000;
  
    u1rb=sisa/1000;
    sisa=sisa%1000;
  
    u5ratus=sisa/500;
  
    cout<<"Uang anda Rp. "<<uang<<endl;
    cout<<"Terdiri dari -->"<<endl;
    cout<<"--------------------"<<endl;
    cout<<u100rb<<" lembar Rp.100.000"<<endl;
    cout<<u50rb<<" lembar Rp.50.000"<<endl;
    cout<<u20rb<<" lembar Rp.20.000"<<endl;
    cout<<u10rb<<" lembar Rp.10.000"<<endl;
    cout<<u5rb<<" lembar Rp.5.000"<<endl;
    cout<<u2rb<<" lembar Rp.2.000"<<endl;
    cout<<u1rb<<" lembar Rp.1.000"<<endl;
    cout<<u5ratus<<" lembar Rp.5.00"<<endl;
    cout<<"---------------------"<<endl;
}



output :

 Raptor :



EmoticonEmoticon