- Joined
- Sep 20, 2016
- Posts
- 1,123
- Solutions
- 7
- Reaction
- 2,576
- Points
- 633
[/CODE]
Code:
May way po ba na ma i add ang string at int para mag loop po yung dalawa na hindi kinoconvert ang isa sa kanila
// eto po yung code
#include <iostream>
#include <sstream>
using namespace std;
string user;
string user1="ryan";
string Ltransaction;
string Maintransaction ;
int AmountToletter;
int main()
{
string choice, transaction;
int pin, deposit, amount , balance, wí†hdráw;
do
{
Ltransaction = "" ;
cout<<"Welcome to Yalung ATM <24 hrs>";
cout<<"\nEnter Username: ";
cin>>user;
cout<<"Enter Pincode: ";
cin>>pin;
if (pin==22 && user==user1)
{
balance=50000;
do
{
do
{
cout<<"\nTRANSACTIONS \nD or d - Deposit \nW or w - wí†hdráw \nB or b - Balance\n";
cout<<"\nEnter Your Transaction: ";
cin>>transaction;
if (transaction=="D" || transaction=="d")
{
do
{
cout<<"Amounts \n1 - 100 \n2 - 200 \n3 - 500 \n4 - 1,000 \n5 - 10,000 \n6 - Others";
cout<<"\nChoose Amount: ";
cin>>choice;
if (choice=="1")
{
amount=100;
}
else if (choice=="2")
{
amount=200;
}
else if (choice=="3")
{
amount=500;
}
else if (choice=="4")
{
amount=1000;
}
else if (choice=="5")
{
amount=10000;
}
else if (choice=="6")
{
cout<<"Enter Amount: ";
cin>>amount;
}
else
{
cout<<"Invalid\n";
amount=0;
}
AmountToletter = amount ;
Ltransaction = "You Deposit:";
do
{
cout<<"Enter Pincode: ";
cin>>pin;
if (pin==22)
{
deposit=balance+amount;
balance=deposit;
cout<<"Deposit Amount: "<<amount<<"\nYour Current Balance is: "<<balance;
}
else if (pin==22 && amount==0)
{
cout<<"Deposit Amount: "<<amount<<"\nYour Current Balance is: "<<balance;
}
else
{
cout<<"\nInvalid Pin!\n";
}
}
while (pin!=22);
cout<<"\nDeposit again? Yes or No?: ";
cin>>choice;
}
while (choice=="Yes");
}
else if (transaction=="W" || transaction=="w")
{
do
{
cout<<"Amounts\n1 - 100\n2 - 200\n3 - 500\n4 - 1,000\n5 - 10,000\n6 - Others";
cout<<"\nChoose Amount: ";
cin>>choice;
if (choice=="1")
{
amount=100;
}
else if (choice=="2")
{
amount=200;
}
else if (choice=="3")
{
amount=500;
}
else if (choice=="4")
{
amount=1000;
}
else if (choice=="5")
{
amount=10000;
}
else if (choice=="6")
{
cout<<"Enter Amount: ";
cin>>amount;
if (amount>balance)
{
cout<<"MACHINE NOW TERMINATING.....\n";
}
}
else
{
cout<<"Invalid\n";
amount=0;
}
do
{
cout<<"Enter Pincode: ";
cin>>pin;
if (pin==22)
{
if (amount<=balance)
{
wí†hdráw=balance-amount;
balance=wí†hdráw;
cout<<"wí†hdráw Amount: "<<amount<<"\nYour Current Balance is: "<<balance;
}
else if (amount>balance)
{
cout<<"wí†hdráw Amount: "<<amount<<"\nYour Current Balance is: "<<balance;
}
else if (amount==0)
{
cout<<"wí†hdráw Amount: "<<amount<<"\nYour Current Balance is: "<<balance;
}
}
else
{
cout<<"\nInvalid Pin!!!!\n";
}
}
while (pin!=22);
cout<<"\nwí†hdráw again? Yes or No?: ";
cin>>choice;
}
while (choice=="Yes");
AmountToletter = amount ;
Ltransaction = "You wí†hdráw:" ;
}
else if (transaction=="B" || transaction=="b")
{
cout<<"Your Balance is: "<<balance<<'\n';
AmountToletter = balance ;
Ltransaction = "You balance:";
}
else
{
cout<<"INVALID TRANSACTION!!\n";
}
stringstream number ;
number << AmountToletter << endl ;
string newString = number.str();
Maintransaction = Maintransaction + Ltransaction + newString ;
}
while (((transaction!="D" && transaction!="d") && (transaction!="W" && transaction!="w")) && (transaction!="B" && transaction!="b"));
cout<<"\nAnother Transaction? Yes or No: ";
cin>>choice;
}
while (choice=="Yes" || choice == "yes");
if (choice == "No" || choice == "no"){
cout << "****** Last transaction*******\n";
cout << Maintransaction ;
cout << "******************************" ;
cout<<"\nTHANK YOU FOR BANKING WITH US!!";
}
}
}
while ((user!=user1 || pin!=22) );
return 0;
}
eto po yung picture
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Last edited: