Vous êtes sur la page 1sur 4

Chloe Sebring

# include <iostream>
# include <fstream>
#include <iomanip>
using namespace std;
void main()
{
ifstream fin;
fin.open("bank.dat");

int id, code = 0;


float amt, balance = 0;

int totDep = 0;
int totWit = 0;
float totAmt = 0;
float totAmtW = 0;

fin >> id >> code >> amt >> balance;


cout << fixed << setprecision(2);

while (!fin.eof())
{ cout << endl;
cout << "Welcome Account #" << id << endl << "Your amount is $" << balance
<< endl;
if (code == 1)
{

balance = balance + amt;


cout << "You have chosen to make a deposit of $" << amt << " making
your total balance $" << balance << endl;
totDep ++;
totAmt = totAmt+ amt;

}
if (code == 2)
{
if (amt > balance)
{
cout << "Account #" << id << endl << "You wish to withdrawl $"
<< amt << ", but you do not have enough funds to withdrawl the amount asked. " << "Please
come back when you have attained $" << amt - balance << " more dollars." << endl;
}
else
{
balance = balance - amt;
cout << "You have chosen to make a withdrawl of $" << amt << "
making your total balance $" << balance << endl;
totWit++;
totAmtW = totAmtW + amt;
if (balance < 100)
{
balance = balance - 10;
cout << "Balance below minium -- $10.00 fee assessed. "
<< "This makes your total balance $" << balance << endl;
}
}

}
else if (code < 1 || code > 2)
{
cout << "It's a beautiful day outside.. the birds are singng.. the flowers
are blooming.. it's on days like this, kids like you..... SHOULD BE ENTERING IN THE RIGHT
CODE! " << endl;
}
//output global stats
fin >> id >> code >> amt >> balance;

cout << endl << "Today this bank has had " << totDep << " deposits and " << totWit
<< " successful withdrawls. Totaling: $" << totAmt << " in deposits and $" << totAmtW <<
" in withdrawls. Thank you for your service!" << endl;
system("Pause");
} # include <iostream>
# include <fstream>
#include <iomanip>
using namespace std;
void main()
{
ifstream fin;
fin.open("bank.dat");

int id, code = 0;


float amt, balance = 0;

int totDep = 0;
int totWit = 0;
float totAmt = 0;
float totAmtW = 0;

fin >> id >> code >> amt >> balance;


cout << fixed << setprecision(2);

while (!fin.eof())
{ cout << endl;
cout << "Welcome Account #" << id << endl << "Your amount is $" << balance
<< endl;
if (code == 1)
{

balance = balance + amt;


cout << "You have chosen to make a deposit of $" << amt << " making
your total balance $" << balance << endl;
totDep ++;
totAmt = totAmt+ amt;

}
if (code == 2)
{
if (amt > balance)
{
cout << "Account #" << id << endl << "You wish to withdrawl $"
<< amt << ", but you do not have enough funds to withdrawl the amount asked. " << "Please
come back when you have attained $" << amt - balance << " more dollars." << endl;
}
else
{
balance = balance - amt;
cout << "You have chosen to make a withdrawl of $" << amt << "
making your total balance $" << balance << endl;
totWit++;
totAmtW = totAmtW + amt;
if (balance < 100)
{
balance = balance - 10;
cout << "Balance below minium -- $10.00 fee assessed. "
<< "This makes your total balance $" << balance << endl;
}
}

}
else if (code < 1 || code > 2)
{
cout << "It's a beautiful day outside.. the birds are singng.. the
flowers are blooming.. it's on days like this, kids like you..... SHOULD BE ENTERING IN
THE RIGHT CODE! " << endl << "Account #" << id << ":Bad Transaction Code" << endl;
//fin >> id >> code >> amt >> balance;
}
//output global stats
fin >> id >> code >> amt >> balance;

cout << endl << "Today this bank has had " << totDep << " deposits and " << totWit
<< " successful withdrawls. Totaling: $" << totAmt << " in deposits and $" << totAmtW <<
" in withdrawls. Thank you for your service!" << endl;
system("Pause")
}

Vous aimerez peut-être aussi