I remade the program and added some better menus i still didnt fix the logical erros can someone please check it out?
Code:
// Declerations
#include "stdafx.h"
#include <iostream>
using namespace std;
int pinnumber;
int pinnumber2 = 1234;
int accountnumber;
int option1;
int doutput;
int dinput;
double bal = 0.00;
double totalbal = bal + (dinput - doutput);
int y, Y, n, N;
int option2;
int option3;
int accnum = 1234;
int withdrawmax = 500;
// Functions in the program
int pinenter();
int menu();
int balance();
int withdraw();
int deposited();
int passusrrec();
int leave();
int main()
{
system("cls");
system("color 09");
system("TITLE Mameman's ATM system 3.0");
cout << "Welcome to Mameman's ATM system!" << endl;
cout << "Please Enter Your Account Number: ";
cin >> accountnumber;
if (accountnumber != 1234)
{
system("cls");
cout << "Please Enter a Valid Account Number." << endl;
system("pause");
passusrrec();
}
pinenter();
}
int pinenter()
{
if (accountnumber == 1234)
{
system("cls");
cout << "Please Enter Your PIN Number: ";
cin >> pinnumber;
if (pinnumber != 1234)
{
system("cls");
cout << "Please Enter a Valid Pin Number." << endl;
system("pause");
passusrrec();
}
}
menu();
return 0;
}
int menu()
{
if (pinnumber == 1234)
{
system("cls");
cout << " *********************************" << endl;
cout << " * Main Menu: *" << endl;
cout << " *********************************" << endl;
cout << " * 1 - View my Balance *" << endl;
cout << " * 2 - Withdraw Cash *" << endl;
cout << " * 3 - Deposit Cash *" << endl;
cout << " * 4 - Exit *" << endl;
cout << " *********************************" << endl;
cout << "nPlease Choose An Option: ";
cin >> option1;
if (option1 == 1)
{
balance();
}
if (option1 == 2)
{
withdraw();
}
if (option1 == 3)
{
deposited();
}
if (option1 == 4)
{
leave();
}
else
{
system("cls");
cout << "That Is Not A Choice Please Pick Another!" << endl;
system("pause");
menu();
}
}
return 0;
}
int balance()
{
system("cls");
cout << "You have Deposited " << dinput << " Dollars." << endl;
cout << "You Have Withdrawn " << doutput << " Dollars." << endl;
cout << "You Have " << bal + (dinput - doutput) << " Dollars." << endl;
system("pause");
menu();
return 0;
}
int withdraw()
{
system("cls");
cout << "Enter How Much Money You Want To Withdraw: ";
cin >> doutput;
if (doutput > withdrawmax)
{
cout << "You Cant Withdraw More Then $500 Per Visit" << endl;
system("pause");
withdraw();
}
if (doutput > bal)
{
cout << "You Don't Have Enough Money to do That Please Pick a Smaller Amount" << endl;
system("pause");
withdraw();
}
if (doutput <= bal)
{
cout << "You Withdrew " << doutput << " Dollars And You Have " << bal - (doutput - dinput) << " Left in Your Account" << endl;
system("pause");
menu();
}
return 0;
}
int deposited()
{
system("cls");
cout << "Enter How Much Money You Want To Deposite: ";
cin >> dinput;
system("cls");
cout << "You Deposited " << dinput << " Dollars And You Have " << bal + (doutput + dinput) << " Dollars in Your Account" << endl;
system("pause");
menu();
return 0;
}
int passusrrec()
{
system("cls");
cout << " ********************************************************************" << endl;
cout << " * Have You Lost Your Account Number? Enter 1 To Recover It *" << endl;
cout << " ********************************************************************" << endl;
cout << " * Have You Lost Your PIN Number? Enter 2 To Recover It *" << endl;
cout << " ********************************************************************" << endl;
cout << "nEnter Your Choice: ";
cin >> option3;
if (option3 == 1)
{
system("cls");
cout << "You Account number is " << accnum << "" << endl;
system("pause");
main();
}
if (option3 == 2)
{
system("cls");
cout << "To Recover Your Pin Number You Will Need to Answer The Following Question" << endl;
system("pause");
system("cls");
cout << "Who created this program?n" << endl;
cout << "1 - Cobrad" << endl;
cout << "2 - Mameman" << endl;
cout << "3 - Bravo" << endl;
cout << "4 - Beau" << endl;
cout << "Enter Your Choice: ";
cin >> option2;
if (option2 == 1)
{
cout << "Wrong, Cobrad Cant Even Program" << endl;
system("pause");
passusrrec();
}
if (option2 == 2)
{
cout << "Correct, Mameman Wrote This" << endl;
cout << "You PIN Number Is " << pinnumber2 << "" << endl;
system("pause");
main();
}
if (option2 == 3)
{
cout << "Wrong, Bravo Didn't Do This" << endl;
system("pause");
passusrrec();
}
if (option2 == 4)
{
cout << "Wrong, Beau Is Too Lazy" << endl;
system("pause");
passusrrec();
}
else
{
cout << "That Is Not A Choice, Pick Another Option" << endl;
system("pause");
passusrrec();
}
}
return 0;
}
int leave()
{
system("cls");
cout << "Good Bye, Please Come Again" << endl;
system("pause");
exit(2);
return 0;
}
there are some logical errors with the withdrawl and deposite and veiw balance part if u know how to fix please tell me cuz i am tryin to expand this progam as much as possible