Академический Документы
Профессиональный Документы
Культура Документы
Username: TRIAL-42971770
Password: vh8t68ru23
1uitm
Username: anas
Password: yf^M3SIOWes#
/*
***Automated Teller Machine with authentication routine***
by MikhaeL Franko T. Mogol
*/
#include<iostream.h>
int main()
int password;
if (password==123456)
{cout<<"korek!!!\n";
switch(option)
{
case 1:
cout<<"\n[[[BALANCE INQUIRY]]]\n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"\n Your current balance is $"<<balance<<endl;
break;
case 2:
cout<<"\n[[[WITHDRAW]]]\n";
cout<<"Enter amount: $";
cin>>withdraw;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
break;
default:
cout<<"\n That is an invalid option \n";
}
break;
}
else
int main()
int password;
switch(option)
{
case 1:
cout<<"\n[[[BALANCE INQUIRY]]]\n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"\n Your current balance is $"<<balance<<endl;
break;
case 2:
cout<<"\n[[[WITHDRAW]]]\n";
cout<<"Enter amount: $";
cin>>withdraw;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
break;
default:
cout<<"\n That is an invalid option \n";
}
}
return 0;
}//
Contoh 3:
/*
***Automated Teller Machine with authentication routine***
by MikhaeL Franko T. Mogol
*/
#include<iostream.h>
int main()
{
double balance = 10000;
double withdraw, deposit;
int option;
int password;
do{cout<<"\n";
cout<<" ***MOGOL***\n";
cout<<"*** Automated Teller Machine***"<<endl;
cout<<"Choose a Transaction:\n";
cout<<"\n";
cout<<"[1] Inquire Balance \n"
<<"[2] Withdraw \n"
<<"[3] Deposit \n"
<<"[4] Quit \n"
<<"\n"
<<"Enter Option:";
cin>>option;
switch(option)
{
case 1:
cout<<"\n[[[BALANCE INQUIRY]]]\n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"\n Your current balance is $"<<balance<<endl;
break;
case 2:
cout<<"\n[[[WITHDRAW]]]\n";
cout<<"Enter amount: $";
cin>>withdraw;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<balance<<endl;
continue;
case 3:
cout<<"\n[[[DEPOSIT]]]\n";
cout<<"Enter amount: $";
cin>>deposit;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
break;
default:
cout<<"\n That is an invalid option \n";
}while(//statement...blah blah, somewhere here,he put some condition,
yah it definitely works!!!
break;
}
else
return 0;
}//
Contoh 4
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<iostream.h>
void main()
{
int choice, a;
float money,m;
clrscr();
void deposite();
void withdraw();
//int func1();
cout<<"Student ID : TATA_12345"<<endl;
cout<<"NAME : RATAN TATA"<<endl;
cout<<"(1) DEPOSITE MONEY"<<endl;
cout<<"(2) WITHDRAW MONEY"<<endl;
cout<<"(3) FIND THE ACCOUNT BALANCE"<<endl;
switch (choice)
{
case 1:
deposite(); /*to deposite money*/
break;
case 2:
withdraw(); /*to withdraw money*/
break;
void deposite()
{
float money;
cout<<endl<<"Enter the amount of money to be deposited(dollars.cents):";
cin>>money; /*read the amount to be deposited*/
if(money>0)
{
cout<<endl<<"$"<<money<<" has been deposited in your account"<<endl;
}
else
cout<<endl<<"Please enter valid amount......."<<endl;
}
void withdraw()
{
long int rem,f,t,e;
long int mon;
cout<<"Enter the amount of money to be withdrawn: ";
cin>>mon; /*read the amount to be withdrawn*/
if(mon>=20)
{
if(mon!=30)
{
f=mon/50; /*decides the notes of $50*/
rem=mon%50;
if(rem!=20)
{
if (rem==10||rem==30)
{
f-=1;
rem+=50;
}
}
t=rem/20; /*decides the notes of $20*/
e=rem%20;
if(e==0)
{
cout<<endl<<"Nos. of 50$ note : "<<f;
cout<<endl;
cout<<"Nos. of 20$ note : "<<t<<endl;
cout<<"TOTAL AMOUNT : "<<mon<<endl;
}
else
cout<<endl<<"This amount is not possible... Please try again"<<endl;
}
else /*if amount is not possible*/
{
cout<<endl;
cout<<"This amount is not possible... Please try again"<<endl;
}
}
else
{
cout<<endl;
cout<<"This amount is not possible... Please try again"<<endl;
}
}