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

Exp7 2

This C++ program defines a class called "acc" to represent a bank account, with data fields for name, account number, type, and balances. It includes functions to accept user input, deposit or withdraw amounts, and display the account details. The main function creates an acc object, gets user input to select deposit or withdraw, calls the appropriate method, and finally displays the updated balance.

Uploaded by

sakharam_gawade
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Exp7 2

This C++ program defines a class called "acc" to represent a bank account, with data fields for name, account number, type, and balances. It includes functions to accept user input, deposit or withdraw amounts, and display the account details. The main function creates an acc object, gets user input to select deposit or withdraw, calls the appropriate method, and finally displays the updated balance.

Uploaded by

sakharam_gawade
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

EXP7_2 #include<iostream.h> #include<conio.

h> class acc { char name[22],type[10]; long no,bal,dbal,wbal; public: acc() { bal=100000; } void accept() { cout<<"\nEnter your name"; cin>>name; cout<<"\nEnter your account no"; cin>>no; cout<<"\nEnter your type"; cin>>type; } void deposit() { cout<<"\nEnter the amount to be deposited"; cin>>dbal; bal=dbal+bal; } void withdraw() { cout<<"\nEnter the amount to withdraw"; cin>>wbal; bal=bal-wbal; } void display() { cout<<"\nName:"<<name; cout<<"\nUpdated Balance:"<<bal; } }; void main() { int i; clrscr(); acc a; a.accept(); cout<<"\nEnter 1 to deposit"; cout<<"\nEnter 2 to withdraw;"; cin>>i; if(i==1) { a.deposit(); a.display(); } else if(i==2) { a. withdraw(); a.display(); } else { a.display(); } getch(); } Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

You might also like