Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Name: Faiz Tahir

Roll No: 070

Section: BSCS-B

Assignment: DSA

Submitted to: Mam Fiza Kazmi


Banking System

#include<iostream>

#include<Windows.h>

using namespace std;

class banking {

int account_no[10];

string name[10];

int Balance[10];

int top = -1, len;

public:

void push(int x,string y,int z) { //To push data into the stack

if (top >= 10)

cout << "overflow" << endl;

else

top++;

account_no[top] = x;

name[top] = y;

Balance[top] = z;
}

void pop() { //To pop data from stack

if (top <= -1)

cout << "underflow" << endl;

else

while (top != -1) {

cout <<"Account no:" << account_no[top] << endl;

cout <<"Customer name:" << name[top] << endl;

cout <<"Balance:" << Balance[top] << endl<<endl<<endl;

top--;

};

int main() {

banking obj;

int choice,rem=10;

a:
cout << "Welcome to the admin account of banking system";

cout << "\nPress 1 to push the data \nPress 2 to pop all the entered

data\nPress 3 to terminate";

cout << "\nEnter Your choice:";

cin >> choice;

string nam;

int acc_no;

int balance;

if (choice == 1) { //Customer data entry

cout << "\nEnter name of customer:";

cin >> nam;

cout << "Enter Account_no:";

cin >> acc_no;

cout << "Enter Balance:";

cin >> balance;

obj.push(acc_no, nam, balance);

else if (choice == 2) { //To pop whole stack

obj.pop();

Sleep(10000);

else if (choice == 3)
terminate;

else

cout << "Wrong choice!Try again";

Sleep(5000);

system("cls");

goto a;

return 0;

You might also like