#include<iostream.h>
#include<conio.h>
#include<math.h>
class
currency
{
int
t,rs,n1000,n500,n100,n50,n20,n10,n5,n2,n1;
public:
currency(int
n)
{ rs=n;}
void
deno();
};
void
currency::deno()
{
t=rs;
n1000=t/1000;
t=t%1000;
n500=t/500;
t=t%500;
n100=t/100;
t=t%100;
n50=t/50;
t=t%50;
n20=t/20;
t=t%20;
n10=t/10;
t=t%10;
n5=t/5;
t=t%5;
n2=t/2;
n1=t%2;
t=n1000+n500+n100+n50+n20+n10+n5+n2+n1;
cout<<" Given Rs. is
"<<rs<<" and the expecting denominations are \n";
cout<<"
1000 :"<<n1000<<endl;
cout<<"
500 :"<<n500<<endl;
cout<<"
100 :"<<n100<<endl;
cout<<"
50 :"<<n50<<endl;
cout<<"
20 :"<<n20<<endl;
cout<<"
10 :"<<n10<<endl;
cout<<"
5 :"<<n5<<endl;
cout<<"
2 :"<<n2<<endl;
cout<<"
1 :"<<n1<<endl;
cout<<"
Total notes \t"<<t<<endl;
getch();
}
void
main()
{ clrscr();
int
n;
cout<<"
Enter your amount:";
cin>>n;
currency
r(n);
r.deno();
}
No comments:
Post a Comment