Dadad
Dadad
int main() {
int balance = 10000;
int pin, option;
int withdrawAmount, depositAmount;
// PIN verification
std::cout << "Enter your PIN: ";
std::cin >> pin;
// Main menu
if (pin == 1234) { // Replace with your desired PIN
do {
std::cout << "\nATM Menu:" << std::endl;
std::cout << "1. Check Balance" << std::endl;
std::cout << "2. Withdraw" << std::endl;
std::cout << "3. Deposit" << std::endl;
std::cout << "4. Exit" << std::endl;
std::cout << "Choose an option: ";
std::cin >> option;
switch (option) {
case 1: // Check Balance
std::cout << "Your balance is $" << balance << std::endl;
break;
case 2: // Withdraw
std::cout << "Enter the amount to withdraw: ";
std::cin >> withdrawAmount;
if (withdrawAmount <= balance) {
balance -= withdrawAmount;
std::cout << "Withdrawal successful. Remaining balance: $"
<< balance << std::endl;
} else {
std::cout << "Insufficient funds!" << std::endl;
}
break;
case 3: // Deposit
std::cout << "Enter the amount to deposit: ";
std::cin >> depositAmount;
balance += depositAmount;
std::cout << "Deposit successful. New balance: $" << balance <<
std::endl;
break;
case 4: // Exit
std::cout << "Thank you for using the ATM. Goodbye!" <<
std::endl;
break;
default:
std::cout << "Invalid option. Please try again." << std::endl;
break;
}
} while (option != 4);
} else {
std::cout << "Incorrect PIN. Access denied." << std::endl;
}
return 0;
}