hello ..

after i write this program there's error i don't know why ? what's the wrong thing?

#include<iostream>

using namespace std;

class Account
{
	private:
   	    int Acc_no ; 
        double balance;
   
    public:

        void SetAccInfo()
		{
				cout<< " please enter your account number\n";
                cin>> Acc_no ;

				cout<< " please enter your balance\n";
                cin>> balance ;
      
		}


		double GetBalance()
		{
				return balance;
      
		}


		void ShowAcc()
		{
				cout<< " Your account number is ";
                cout<< Acc_no ;
		}


		void Credit()
		{
				double amount1;

				cout<< " please enter the value you want to add in your account\n";
                cin>> amount1;

				balance = balance + amount1;
      
		}


		void Debit()
		{
				double amount2;

				cout<< " please enter the value that you want to willdrow from your account\n";
                cin>> amount2;

				if ( balance >= amount2 )
				{

                 balance = balance - amount2;

                 else
					 cout<<" You debit amount exceed the account's balance\n";
		}

};


int main()
{
    Account S1;

	S1.SetAccInfo();
	S1.GetBalance();
	S1.ShowAcc();
	S1.Credit();
	S1.Debit();

    return 0;
}

thanx :)

Recommended Answers

All 7 Replies

>after i write this program there's error i don't know why ?
It's customary to post the error as well as the code. Most of us can tell you what's wrong by reading the error, but if we only have the code we have to read it carefully or compile it ourselves (both add annoying extra steps to helping you).

A brief description of the assignment would also be helpful

It looks like a simple bank account manager.

the error is
unexpected end of file found

You have a rogue opening brace in the Debit member function. Replace yours with this:

void Debit()
{
  double amount2;

  cout<< " please enter the value that you want to willdrow from your account\n";
  cin>> amount2;

  if ( balance >= amount2 )
    balance = balance - amount2;
  else
    cout<<" You debit amount exceed the account's balance\n";
}

Ptolemy - welcome aboard and good catch. If there is an additional or a difference is brace count, then that's the error message that the compiler will display.

thanxx aloot Ptolemy 4 the help .. it's work know :) .. and thanx 4 every one who tried to help me :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.