diff --git a/Account/Account.cpp b/Account/Account.cpp index d198f59..6f59ecf 100644 --- a/Account/Account.cpp +++ b/Account/Account.cpp @@ -8,10 +8,10 @@ using namespace std; // Forgive me #include "Account.h" // Account constructor initializes data member balance -Account::Account( int initialBalance ) +Account::Account( int initialBalance ):Persoana() { balance = 0; // assume that the balance begins at 0 - /* if initialBalance is greater than 0, + /* if initialBalance is greater than 0, set this value as the balance of the Account; otherwise, balance remains 0 */ if ( initialBalance > 0 ) balance = initialBalance; @@ -20,7 +20,9 @@ Account::Account( int initialBalance ) if ( initialBalance < 0 ) cout << "Error: Initial balance cannot be negative.\n" << endl; } // end Account constructor - +//Account::Account(int balance): Persoana(){ +// balance =0; +//} // credit (add) an amount to the account balance void Account::credit( int amount ) { @@ -41,4 +43,18 @@ void Account::debit( int amount) int Account::getBalance() { return balance; // gives the value of balance to the calling function -} // end function getBalance \ No newline at end of file +} // end function getBalance +int Account::plata(){ + int sumaPlata; + cout<<"Introduceti suma de plata: "; + cin>>sumaPlata; + cout<<"Introduceti numele beneficiarului: "; + cin>>_beneficiar; + balance-=sumaPlata; + cout<<"Plata: "<<_beneficiar<<" Suma: "< +using namespace std; +#include "../AcountMhcrnl/persoana.h" +#include +class Account: public Persoana{ +private: int balance; // data member that stores the balance - - public: + string _beneficiar; +public: + Account(); Account( int ); // constructor initializes balance + Account (string nume, string prenume, int balance); void credit( int ); // add an amount to the account balance void debit( int ); // subtract an amount to the account balance int getBalance(); // return the account balance -}; // end class Account \ No newline at end of file + int plata(void); + /** + Add friend function for print Account + */ + friend ostream& operator<<(ostream& os, const Account& cont); +}; // end class Account +#endif diff --git a/AcountMhcrnl/AcountMhcrnl.cbp b/AcountMhcrnl/AcountMhcrnl.cbp new file mode 100644 index 0000000..7500d81 --- /dev/null +++ b/AcountMhcrnl/AcountMhcrnl.cbp @@ -0,0 +1,47 @@ + + + + + + diff --git a/AcountMhcrnl/AcountMhcrnl.depend b/AcountMhcrnl/AcountMhcrnl.depend new file mode 100644 index 0000000..d7bda37 --- /dev/null +++ b/AcountMhcrnl/AcountMhcrnl.depend @@ -0,0 +1,22 @@ +# depslib dependency file v1.0 +1486203966 source:c:\users\mhcrnl\desktop\cpp-6\account\account.cpp + + "Account.h" + +1486206067 c:\users\mhcrnl\desktop\cpp-6\account\account.h + + "../AcountMhcrnl/persoana.h" + + +1486205614 source:c:\users\mhcrnl\desktop\cpp-6\acountmhcrnl\main.cpp + + "../Account/Account.h" + "persoana.h" + +1486204954 c:\users\mhcrnl\desktop\cpp-6\acountmhcrnl\persoana.h + + + +1486202980 source:c:\users\mhcrnl\desktop\cpp-6\acountmhcrnl\persoana.cpp + "persoana.h" + diff --git a/AcountMhcrnl/AcountMhcrnl.layout b/AcountMhcrnl/AcountMhcrnl.layout new file mode 100644 index 0000000..f3ad5be --- /dev/null +++ b/AcountMhcrnl/AcountMhcrnl.layout @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AcountMhcrnl/main.cpp b/AcountMhcrnl/main.cpp new file mode 100644 index 0000000..f6e79fc --- /dev/null +++ b/AcountMhcrnl/main.cpp @@ -0,0 +1,20 @@ +#include +#include "../Account/Account.h" +#include "persoana.h" +using namespace std; + +int main() +{ + cout << "Hello world!" << endl; + Account cont(50); + + cout<>_nume; + return _nume; +} + +string Persoana::setPrenume(){ + cout<<"Insert person lastname: "; + cin>>_prenume; + return _prenume; +} diff --git a/AcountMhcrnl/persoana.h b/AcountMhcrnl/persoana.h new file mode 100644 index 0000000..ea92922 --- /dev/null +++ b/AcountMhcrnl/persoana.h @@ -0,0 +1,23 @@ +#ifndef PERSOANA_H_INCLUDED +#define PERSOANA_H_INCLUDED +#include +#include +//#include "../Account/Account.h" +using namespace std; +class Persoana { +protected: + string _nume; + string _prenume; +public: + /** + Constructor + */ + Persoana(); + /** + get/set + */ + string setNume(void); + string setPrenume(void); +}; + +#endif // PERSOANA_H_INCLUDED