i fixed the logical errors there is nothing wrong with it but any improvements are appreciated leave comments =)
Code:
// Declarations
#include "stdafx.h"
#include <iostream>
using namespace std;
int pinnumber;
int pinnumber2 = 1234;
int accountnumber;
int option1;
int doutput;
int dinput;
double bal = 100;
double totalbal = bal + dinput - doutput;
int y, Y, n, N;
int option2;
int option3;
int accnum = 1234;
int withdrawmax = 500;
int colorselect1;
// Functions in the program
int pinenter();
int menu();
int balance();
int withdraw();
int deposited();
int mainmenu();
int passusrrec();
int leave();
int colorselect();
int main()
{
colorselect();
return 0;
}
int colorselect()
{
system("cls");
system("color 09");
system("TITLE Mameman's ATM system 4.0");
cout << " What Colors Would You Like This To Be In?" << endl;
cout << " ****************************" << endl;
cout << " * 1 - Blue *" << endl;
cout << " * 2 - Bright White *" << endl;
cout << " * 3 - Bright Red *" << endl;
cout << " * 4 - Random *" << endl;
cout << " ****************************" << endl;
cin >> colorselect1;
mainmenu();
return 0;
}
int mainmenu()
{
if (colorselect1 == 1)
{
system("color 09");
}
if (colorselect1 == 2)
{
system("color 0f");
}
if (colorselect1 == 3)
{
system("color 0c");
}
if (colorselect1 == 4)
{
system("color 09");
}
system("cls");
system("TITLE Mameman's ATM system 4.0");
cout << "Welcome to Mameman's ATM system!" << endl;
cout << "Since This Is Your First Time We Started You Off With $100" << endl;
cout << "Please Enter Your Account Number: ";
cin >> accountnumber;
if (accountnumber != 1234)
{
system("cls");
cout << "Please Enter a Valid Account Number." << endl;
system("@ping.exe 127.0.0.1 -n 5 -w 1000 > nul");
passusrrec();
}
cout << "Please Enter Your PIN Number: ";
cin >> pinnumber;
if (pinnumber != 1234)
{
system("cls");
cout << "Please Enter a Valid Pin Number." << endl;
system("@ping.exe 127.0.0.1 -n 5 -w 1000 > nul");
passusrrec();
}
menu();
return 0;
}
int menu()
{
if (colorselect1 == 4)
{
system("color 0f");
}
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 - Change Color *" << endl;
cout << " * 5 - 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)
{
colorselect();
}
if (option1 == 5)
{
leave();
}
else
{
system("cls");
cout << "That Is Not A Choice, Please Pick Another!" << endl;
system("@ping.exe 127.0.0.1 -n 4 -w 1000 > nul");
menu();
}
return 0;
}
int balance()
{
if (colorselect1 == 4)
{
system("color 0c");
}
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()
{
if (colorselect1 == 4)
{
system("color 02");
}
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("@ping.exe 127.0.0.1 -n 4 -w 1000 > nul");
withdraw();
}
if (doutput > bal)
{
cout << "You Don't Have Enough Money to do That Please Pick a Smaller Amount" << endl;
system("@ping.exe 127.0.0.1 -n 6 -w 1000 > nul");
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()
{
if (colorselect1 == 4)
{
system("color 08");
}
system("cls");
cout << "Enter How Much Money You Want To Deposit: ";
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()
{
if (colorselect1 == 4)
{
system("color 01");
}
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("@ping.exe 127.0.0.1 -n 3 -w 1000 > nul");
passusrrec();
}
}
return 0;
}
int leave()
{
if (colorselect1 == 4)
{
system("color 09");
}
system("cls");
cout << "Good Bye," << endl;
system("@ping.exe 127.0.0.1 -n 2 -w 1000 > nul");
cout << "Please Come Again" << endl;
system("@ping.exe 127.0.0.1 -n 2 -w 1000 > nul");
exit(2);
return 0;
}