Mauwanna0327
Eternal Poster
- Joined
- Jul 20, 2017
- Posts
- 773
- Reaction
- 114
- Points
- 269
#include <iostream>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
using namespace std;
//FUNCTIONS
int accReg ();
int login ();
int menu ();
int deposit ();
int wí†hdráw ();
int check ();
int balance = 10000;
int accNo = NULL;
int col = NULL;
int dep, wd, checkBalance;
int depositedbal = 0;
int wí†hdráwnbal = 0;
string user [100] [2];
string username, password;
int main()
{
cout<<"\n---------------------------------"<<endl;
cout<<" welcome "<<endl;
cout<<"---------------------------------"<<endl;
system ("pause");
system ("cls");
int choice;
cout<<"\n----- homepage ----- " <<endl;
cout<<"[1] - sign up for an account " <<endl;
cout<<"[2] - log in " <<endl;
cout<<"[3] - goto administrator`s menu " <<endl;
cout<<"\nEnter choice: ";
cin>>choice;
if (choice == '1')
{
system ("cls");
accReg();
}
else if (choice == '2')
{
system ("cls");
login();
}
else if (choice == 'C' || choice == 'c')
{
system ("cls");
struct Record
{
int d;
int w;
int cb;
int bal;
int db;
int wb;
Record *next;
};
Record *head;
head = NULL;
Record *newRecord;
Record *recordPointer;
newRecord = new Record;
newRecord -> d = dep;
newRecord -> w = wd;
newRecord -> cb = checkBalance;
newRecord -> bal = balance;
newRecord -> db = depositedbal;
newRecord -> wb = wí†hdráwnbal;
newRecord -> next = NULL;
if (head == NULL)
{
head = newRecord;
}
else
{
recordPointer = head;
while (recordPointer -> next)
{
recordPointer = recordPointer -> next;
}
recordPointer -> next = newRecord;
}
cout<<"\n----- T R A N S A C T I O N R E C O R D -----"<<endl<<endl;
cout<<"Transaction Number\tUsername\tType of Transaction\tAmount\tBalance"<<endl;
Record *displayP;
displayP = head;
while (displayP)
{
int row = 0;
if (displayP->d!=NULL)
{
cout<<" "<<row<<" \t"<<username<<"\tDeposit \t"<<displayP->d<<" \t"<<displayP->db<<endl;
row++;
}
if (displayP->cb!=NULL)
{
if (displayP->d!=NULL)
{
displayP->bal = displayP->db;
cout<<" "<<row<<" \t"<<username<<"\tCheck Balance\t\t\t\t"<<displayP->bal<<endl;
row++;
}
else
{
cout<<" "<<row<<" \t"<<username<<"\tCheck Balance\t\t\t\t"<<displayP->bal<<endl;
row++;
}
}
if (displayP->w!=NULL)
{
if (displayP->bal == displayP->db)
{
displayP->wb = displayP->bal - displayP->w;
cout<<" "<<row<<" \t"<<username<<"\twí†hdráw \t"<<displayP->w<<" \t"<<displayP->wb<<endl;
row++;
}
}
displayP = displayP->next;
cout<<endl;
}
char homechoice;
cout<<"\n\nDo you want to go to homepage? "<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>homechoice;
if (homechoice == 'Y' || homechoice == 'y')
{
system("cls");
main();
}
else
{
return 0;
}
}
else if (choice == 'D' || choice == 'd')
{
system ("cls");
cout<<"\n----- A C C O U N T L I S T -----"<<endl<<endl;
cout<<"Account Number \t Username \t Password"<<endl;
struct accList
{
int a;
int b;
accList *next;
};
accList *head;
head = NULL;
accList *newList;
newList = new accList;
newList -> a = accNo;
newList -> b = col;
newList -> next = NULL;
head = newList;
accList *displayP;
displayP = head;
while (displayP)
{
for (int a = 0; a<=accNo; a++)
{
cout<<" "<<a<<" \t";
for (int b = 0; b<2; b++) {
cout<<user [a] <<"\t\t";
}
cout<<endl;
}
displayP = displayP -> next;
cout<<endl;
}
char homechoice;
cout<<"\n\nDo you want to go to homepage?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>homechoice;
if (homechoice == 'Y' || homechoice == 'y')
{
system ("cls");
main();
}
else
{
return 0;
}
}
else
{
cout<<"\n\nInvalid choice.";
system ("pause");
system ("cls");
main();
}
}
int accReg()
{
cout<<"\n----- sign up for an account -----"<<endl<<endl;
char cho;
int col = 0;
cout<<"Account Number ["<<accNo<<"]"<<endl;
cout<<"Enter username: ";
cin>>user [accNo] [col];
col++;
cout<<"Enter password: ";
cin>>user [accNo] [col];
cout<<"\n\nDo you want to register another account? "<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"Enter choice: ";
cin>>cho;
if (cho == 'Y' || cho == 'y')
{
system ("cls");
accNo++;
accReg();
}
else
{
system("cls");
main();
}
}
int login()
{
cout<<"\n----- L O G I N -----"<<endl<<endl;
int no;
cout<<"Enter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
else
{
int no;
cout<<"\nEnter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
}
else
{
int no;
cout<<"\nEnter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
}
else
{
cout<<"\nSorry, you've reached the number of tries to login.";
system ("pause");
system ("cls");
main();
}
}
}
}
}
int menu()
{
cout<<"\n----- M E N U -----"<<endl<<endl;
int c, c1;
cout<< "[1] - Account List" <<endl;
cout<< "[2] - Deposit" <<endl;
cout<< "[3] - wí†hdráw" <<endl;
cout<< "[4] - Check Balance" <<endl;
cout<< "[5] - Homepage" <<endl;
cout<< "[6] - Transaction Record" <<endl;
cout<<"[9] - Exit"<<endl;
cout<<"\nEnter choice: ";
cin>>c;
if (c == 'A' || c == 'a')
{
system("cls");
deposit();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'B' || c == 'b')
{
system ("cls");
wí†hdráw();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'C' || c == 'c')
{
system ("cls");
check();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'D' || c == 'd')
{
system ("cls");
main();
}
else if (c == 'E' || c == 'e')
{
return 0;
}
else
{
cout<<"\nInvalid choice."<<endl;
system ("cls");
menu();
}
}
int deposit()
{
cout<<"\nEnter amount to deposit: ";
cin>>dep;
cout<<"\nYou successfully deposit "<<dep<<" pesos.";
balance = balance + dep;
depositedbal = balance;
}
int wí†hdráw()
{
cout<<"\nEnter amount to wí†hdráw: ";
cin>>wd;
if (wd>=100 && wd%100==0 && wd<=balance)
{
cout<<"\nYou successfully wí†hdráw "<<wd<<" pesos.";
}
else
{
cout<<"\nInvalid amount to wí†hdráw.";
}
balance = balance - wd;
wí†hdráwnbal = balance;
}
int check()
{
checkBalance = balance;
cout<<"\nYour balance is "<<checkBalance<<" pesos.";
}
#include <string>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
using namespace std;
//FUNCTIONS
int accReg ();
int login ();
int menu ();
int deposit ();
int wí†hdráw ();
int check ();
int balance = 10000;
int accNo = NULL;
int col = NULL;
int dep, wd, checkBalance;
int depositedbal = 0;
int wí†hdráwnbal = 0;
string user [100] [2];
string username, password;
int main()
{
cout<<"\n---------------------------------"<<endl;
cout<<" welcome "<<endl;
cout<<"---------------------------------"<<endl;
system ("pause");
system ("cls");
int choice;
cout<<"\n----- homepage ----- " <<endl;
cout<<"[1] - sign up for an account " <<endl;
cout<<"[2] - log in " <<endl;
cout<<"[3] - goto administrator`s menu " <<endl;
cout<<"\nEnter choice: ";
cin>>choice;
if (choice == '1')
{
system ("cls");
accReg();
}
else if (choice == '2')
{
system ("cls");
login();
}
else if (choice == 'C' || choice == 'c')
{
system ("cls");
struct Record
{
int d;
int w;
int cb;
int bal;
int db;
int wb;
Record *next;
};
Record *head;
head = NULL;
Record *newRecord;
Record *recordPointer;
newRecord = new Record;
newRecord -> d = dep;
newRecord -> w = wd;
newRecord -> cb = checkBalance;
newRecord -> bal = balance;
newRecord -> db = depositedbal;
newRecord -> wb = wí†hdráwnbal;
newRecord -> next = NULL;
if (head == NULL)
{
head = newRecord;
}
else
{
recordPointer = head;
while (recordPointer -> next)
{
recordPointer = recordPointer -> next;
}
recordPointer -> next = newRecord;
}
cout<<"\n----- T R A N S A C T I O N R E C O R D -----"<<endl<<endl;
cout<<"Transaction Number\tUsername\tType of Transaction\tAmount\tBalance"<<endl;
Record *displayP;
displayP = head;
while (displayP)
{
int row = 0;
if (displayP->d!=NULL)
{
cout<<" "<<row<<" \t"<<username<<"\tDeposit \t"<<displayP->d<<" \t"<<displayP->db<<endl;
row++;
}
if (displayP->cb!=NULL)
{
if (displayP->d!=NULL)
{
displayP->bal = displayP->db;
cout<<" "<<row<<" \t"<<username<<"\tCheck Balance\t\t\t\t"<<displayP->bal<<endl;
row++;
}
else
{
cout<<" "<<row<<" \t"<<username<<"\tCheck Balance\t\t\t\t"<<displayP->bal<<endl;
row++;
}
}
if (displayP->w!=NULL)
{
if (displayP->bal == displayP->db)
{
displayP->wb = displayP->bal - displayP->w;
cout<<" "<<row<<" \t"<<username<<"\twí†hdráw \t"<<displayP->w<<" \t"<<displayP->wb<<endl;
row++;
}
}
displayP = displayP->next;
cout<<endl;
}
char homechoice;
cout<<"\n\nDo you want to go to homepage? "<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>homechoice;
if (homechoice == 'Y' || homechoice == 'y')
{
system("cls");
main();
}
else
{
return 0;
}
}
else if (choice == 'D' || choice == 'd')
{
system ("cls");
cout<<"\n----- A C C O U N T L I S T -----"<<endl<<endl;
cout<<"Account Number \t Username \t Password"<<endl;
struct accList
{
int a;
int b;
accList *next;
};
accList *head;
head = NULL;
accList *newList;
newList = new accList;
newList -> a = accNo;
newList -> b = col;
newList -> next = NULL;
head = newList;
accList *displayP;
displayP = head;
while (displayP)
{
for (int a = 0; a<=accNo; a++)
{
cout<<" "<<a<<" \t";
for (int b = 0; b<2; b++) {
cout<<user [a] <<"\t\t";
}
cout<<endl;
}
displayP = displayP -> next;
cout<<endl;
}
char homechoice;
cout<<"\n\nDo you want to go to homepage?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>homechoice;
if (homechoice == 'Y' || homechoice == 'y')
{
system ("cls");
main();
}
else
{
return 0;
}
}
else
{
cout<<"\n\nInvalid choice.";
system ("pause");
system ("cls");
main();
}
}
int accReg()
{
cout<<"\n----- sign up for an account -----"<<endl<<endl;
char cho;
int col = 0;
cout<<"Account Number ["<<accNo<<"]"<<endl;
cout<<"Enter username: ";
cin>>user [accNo] [col];
col++;
cout<<"Enter password: ";
cin>>user [accNo] [col];
cout<<"\n\nDo you want to register another account? "<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"Enter choice: ";
cin>>cho;
if (cho == 'Y' || cho == 'y')
{
system ("cls");
accNo++;
accReg();
}
else
{
system("cls");
main();
}
}
int login()
{
cout<<"\n----- L O G I N -----"<<endl<<endl;
int no;
cout<<"Enter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
else
{
int no;
cout<<"\nEnter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
}
else
{
int no;
cout<<"\nEnter account number: ";
cin>>no;
cout<<"Enter username: ";
cin>>username;
cout<<"Enter password: ";
cin>>password;
if (no>=0 && no<=accNo)
{
if (username == user [no] [0] && password == user [no] [1])
{
cout<<"\nLogin Successfully!"<<endl;
system ("pause");
system ("cls");
menu();
}
}
else
{
cout<<"\nSorry, you've reached the number of tries to login.";
system ("pause");
system ("cls");
main();
}
}
}
}
}
int menu()
{
cout<<"\n----- M E N U -----"<<endl<<endl;
int c, c1;
cout<< "[1] - Account List" <<endl;
cout<< "[2] - Deposit" <<endl;
cout<< "[3] - wí†hdráw" <<endl;
cout<< "[4] - Check Balance" <<endl;
cout<< "[5] - Homepage" <<endl;
cout<< "[6] - Transaction Record" <<endl;
cout<<"[9] - Exit"<<endl;
cout<<"\nEnter choice: ";
cin>>c;
if (c == 'A' || c == 'a')
{
system("cls");
deposit();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'B' || c == 'b')
{
system ("cls");
wí†hdráw();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'C' || c == 'c')
{
system ("cls");
check();
cout<<"\nDo you want another transaction?"<<endl;
cout<<"[Y] - YES"<<endl;
cout<<"[N] - NO"<<endl;
cout<<"\nEnter choice: ";
cin>>c1;
if (c1 == 'Y' || c1 == 'y')
{
system("cls");
menu();
}
else
{
return 0;
}
}
else if (c == 'D' || c == 'd')
{
system ("cls");
main();
}
else if (c == 'E' || c == 'e')
{
return 0;
}
else
{
cout<<"\nInvalid choice."<<endl;
system ("cls");
menu();
}
}
int deposit()
{
cout<<"\nEnter amount to deposit: ";
cin>>dep;
cout<<"\nYou successfully deposit "<<dep<<" pesos.";
balance = balance + dep;
depositedbal = balance;
}
int wí†hdráw()
{
cout<<"\nEnter amount to wí†hdráw: ";
cin>>wd;
if (wd>=100 && wd%100==0 && wd<=balance)
{
cout<<"\nYou successfully wí†hdráw "<<wd<<" pesos.";
}
else
{
cout<<"\nInvalid amount to wí†hdráw.";
}
balance = balance - wd;
wí†hdráwnbal = balance;
}
int check()
{
checkBalance = balance;
cout<<"\nYour balance is "<<checkBalance<<" pesos.";
}