0% found this document useful (0 votes)
8 views4 pages

ATM Interface

The document is a C++ program for an ATM interface that includes functionalities such as logging in with a PIN, checking balance, withdrawing and depositing money, and changing the PIN. It allows users to attempt logging in up to three times before locking the account. The program features a menu-driven interface for user interaction.

Uploaded by

karthikeyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

ATM Interface

The document is a C++ program for an ATM interface that includes functionalities such as logging in with a PIN, checking balance, withdrawing and depositing money, and changing the PIN. It allows users to attempt logging in up to three times before locking the account. The program features a menu-driven interface for user interaction.

Uploaded by

karthikeyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

ATM Interface

#include <iostream>

using namespace std;

//Login system

int pin = 1234;

float balance = 10000.00;

bool login() {

int pinnumber;

int attempts = 0;

while(attempts < 3) {

cout << "Enter a 4-digit PIN : ";

cin >> pinnumber;

if(pinnumber == pin) {

cout << "Login successful!\n";

return true;

else {

cout<< "Incorrect PIN.\n";

attempts++;

cout<<"Account locked!";

return false;

//checking balance

void checkbalance() {

cout << "Your current balance is : Rs."<<balance << endl;


}

//Withdraw Function

void withdraw() {

float amount;

cout<<"Enter amount to withdraw : Rs.";

cin>>amount;

if(amount > balance) {

cout << "Insufficient balance!";

else {

balance = balance - amount;

cout << "Withdrawal successful. Remaining balance: Rs." << balance << endl;

//Deposit Function

void deposit() {

float amount;

cout<<"Enter amount to deposit :";

cin>>amount;

balance = balance + amount;

cout<<"Deposit successful. Balance : Rs." << balance << endl;

void changePIN() {

int newpin;

cout<<"Enter new 4-digit PIN:";

cin>>newpin;

pin = newpin;

cout<<"PIN changed successfully\n";

}
void Menu() {

int choice;

do {

cout<<" ---ATM MENU---\n";

cout<<"1.Check Balance\n";

cout<<"2.Withdraw Money\n";

cout<<"3.Deposit Money\n";

cout<<"4.Change PIN\n";

cout<<"5.Exit\n";

cout<<"Enter your choice: ";

cin>>choice;

switch (choice) {

case 1:

checkbalance();

break;

case 2:

withdraw();

break;

case 3:

deposit();

break;

case 4:

changePIN();

break;

case 5:

cout<<"Exit";

break;

default:

cout<<"Choice Invalid";
}

while(choice != 5);

int main() {

cout << "#### Welcome to ATM Interface ####\n";

if(login()) {

Menu();

return 0;

You might also like