Monday, 28 January 2013

Wirite a C/C++ program to define a class to represent a Bank Account.

This program for Turbo c++, write and compile/run it...
Define a class to represent a Bank Account. Include the following members:

A. Data Members:
     (i) Name of the Depositor.
     (ii) Account Number.
     (iii) Type of Account.
     (iv) Balance Amount.

B. Members Function:
     (i) To deposit an amount.
     (ii) To display Name and Balance.


class BankAccount{
   char name[10], type[10];
   int ac;
   double bal;


   void deposit(){
   cout<<"Name of Depositor:";
   cout<<"Account Number:";
   cout<<"Enter Account Type:";

  void display(){
  cout<<"\nName :"<<name<<" Balance Rs. "<<bal<<"/-";


void main(){
  BankAccount a[100];
  int i,n;
  cout<<"List Length:";
  for(i=0; i<n; i++){

  for(i=0; i<n; i++){


List Length:3

Name of Depositor: Asif
Account Number: 101
Enter Account Type: Savings
Balance: 2000

Name of Depositor: Sufia
Account Number: 102
Enter Account Type: Savings
Balance: 5000

Name of Depositor: Jayanta
Account Number: 103
Enter Account Type: Current
Balance: 1500

Name : Asif   Balance Rs.2000/-
Name : Sufia   Balance Rs.5000/-
Name : Jayanta   Balance Rs.1500/-

Thanks for watching...
Comment it...