A very simple program of ATM which will give u minimum number of notes for the entered amount.
Here we have assumed that ATM has 500000 INR at max.
#include<conio.h>
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
int th,fh,oh,total=500000; // th=thousand, fh= five hundred, oh= one hundred.
int th1=0,fh1=0,oh1=0;
int amnt=0,rem=0;
cout<<"\n Welcome to the ATM";
cout<<"\n Enter amount to be drawn ";
cin>>amnt;
if(amnt%100==0)
{
if(amnt<=total)
{
rem=amnt%1000;
th1=amnt/1000;
th=th-th1;
fh1=rem/500;
fh=fh-fh1;
rem=rem%500;
oh1=rem/100;
oh=oh-oh1;
total=total-amnt;
cout<<"\n your transaction is being processed: ";
Sleep(100);
cout<<"\n collec your money and count";
cout<<"\n number of 1000 Rs notes ="<<th1;
cout<<"\n number of 500 Rs notes ="<<fh1;
cout<<"\n number of 100 Rs notes ="<<oh1;
cout<<"\n\n\n Have a nice day, \n please visit again";
}
else cout<<"\n ATM is currently short of amount, please visit another ATM ";
}
else cout<<"Please enter emount ni multiple of 100 ";
getch();
return 0;
}
Here we have assumed that ATM has 500000 INR at max.
#include<conio.h>
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
int th,fh,oh,total=500000; // th=thousand, fh= five hundred, oh= one hundred.
int th1=0,fh1=0,oh1=0;
int amnt=0,rem=0;
cout<<"\n Welcome to the ATM";
cout<<"\n Enter amount to be drawn ";
cin>>amnt;
if(amnt%100==0)
{
if(amnt<=total)
{
rem=amnt%1000;
th1=amnt/1000;
th=th-th1;
fh1=rem/500;
fh=fh-fh1;
rem=rem%500;
oh1=rem/100;
oh=oh-oh1;
total=total-amnt;
cout<<"\n your transaction is being processed: ";
Sleep(100);
cout<<"\n collec your money and count";
cout<<"\n number of 1000 Rs notes ="<<th1;
cout<<"\n number of 500 Rs notes ="<<fh1;
cout<<"\n number of 100 Rs notes ="<<oh1;
cout<<"\n\n\n Have a nice day, \n please visit again";
}
else cout<<"\n ATM is currently short of amount, please visit another ATM ";
}
else cout<<"Please enter emount ni multiple of 100 ";
getch();
return 0;
}
No comments:
Post a Comment