0% found this document useful (0 votes)
2 views

backup

This document contains a C++ program that simulates an ATM interface. Users can enter a PIN to access options such as checking balance, withdrawing, and depositing money. The program includes basic error handling for insufficient funds and invalid options.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

backup

This document contains a C++ program that simulates an ATM interface. Users can enter a PIN to access options such as checking balance, withdrawing, and depositing money. The program includes basic error handling for insufficient funds and invalid options.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<iostream.

h>
#include<conio.h>
int main() {
int balance = 10000;
int pin, option;
int withdrawAmount, depositAmount;
clrscr();
gotoxy(30,1);
cout << "Welcome to the ATM!" ;

gotoxy(10,5);
cout << "Enter your PIN: ";
gotoxy(10,9);
cout << "Remarks--";
gotoxy(32,9);
cin >> pin;

clrscr();
// Main menu
if (pin == 123456) { /
do {
gotoxy(30,1);
cout << "\nATM Menu:";
gotoxy(5,3);
cout << "1. Check Balance";
gotoxy(5,4);
cout << "2. Withdraw";
gotoxy(5,5);
cout << "3. Deposit";
gotoxy(5,6);
cout << "4. Exit";
gotoxy(5,7);
cout << "Choose an option: ";
cin >> option;

switch (option) {
case 1: // Check Balance
cout << "Your balance is $" << balance;
break;

case 2: // Withdraw
cout << "Enter the amount to withdraw: ";
cin >> withdrawAmount;
if (withdrawAmount <= balance) {
balance -= withdrawAmount;
cout << "Withdrawal successful. Remaining balance: $" << balance;
} else {
cout << "Insufficient funds!" ;
}
break;

case 3: // Deposit
cout << "Enter the amount to deposit: ";
cin >> depositAmount;
balance += depositAmount;
cout << "Deposit successful. New balance: $" << balance;
break;

case 4: // Exit
cout << "Thank you for using the ATM. Goodbye!";
break;

default:
cout << "Invalid option. Please try again.";
break;
}
} while (option != 4);
} else {
cout << "Incorrect PIN. Access denied.";
}

return 0;
}

You might also like