*.cpp *.h: vim settings for 2-spaces instead of tabs
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
06b00b9f97
commit
768916ff0d
3 changed files with 39 additions and 34 deletions
12
account.cpp
12
account.cpp
|
@ -1,24 +1,24 @@
|
|||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "account.h"
|
||||
|
||||
Account::Account ( double initial_balance ) : balance(initial_balance) {
|
||||
}
|
||||
|
||||
Account::~Account () {
|
||||
cout << "account deleted" << endl;
|
||||
std::cout << "account deleted" << std::endl;
|
||||
}
|
||||
|
||||
double Account::getBalance() const {
|
||||
return balance;
|
||||
return balance;
|
||||
}
|
||||
|
||||
void Account::deposit(double amount) {
|
||||
balance += amount;
|
||||
balance += amount;
|
||||
}
|
||||
|
||||
void Account::withdraw(double amount) {
|
||||
balance -= amount;
|
||||
balance -= amount;
|
||||
}
|
||||
|
||||
// vim:set sts=2 sw=2 et:
|
||||
|
|
40
account.h
40
account.h
|
@ -9,36 +9,38 @@
|
|||
*/
|
||||
class Account
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
/* ==================== LIFECYCLE ======================================= */
|
||||
//Account (); /* constructor */
|
||||
//Account ( const Account &other ); /* copy constructor */
|
||||
Account ( double initial_balance );
|
||||
~Account (); /* destructor */
|
||||
/* ==================== LIFECYCLE ======================================= */
|
||||
//Account (); /* constructor */
|
||||
//Account ( const Account &other ); /* copy constructor */
|
||||
Account ( double initial_balance );
|
||||
~Account (); /* destructor */
|
||||
|
||||
/* ==================== ACCESSORS ======================================= */
|
||||
/* ==================== ACCESSORS ======================================= */
|
||||
|
||||
// current balance of the Account
|
||||
double getBalance() const;
|
||||
// current balance of the Account
|
||||
double getBalance() const;
|
||||
|
||||
/* ==================== MUTATORS ======================================= */
|
||||
/* ==================== MUTATORS ======================================= */
|
||||
|
||||
void deposit(double amount);
|
||||
void withdraw(double amount);
|
||||
void deposit(double amount);
|
||||
void withdraw(double amount);
|
||||
|
||||
/* ==================== OPERATORS ======================================= */
|
||||
/* ==================== OPERATORS ======================================= */
|
||||
|
||||
Account& operator = ( const Account &other ); /* assignment operator */
|
||||
Account& operator = ( const Account &other ); /* assignment operator */
|
||||
|
||||
protected:
|
||||
/* ==================== DATA MEMBERS ======================================= */
|
||||
protected:
|
||||
/* ==================== DATA MEMBERS ======================================= */
|
||||
|
||||
private:
|
||||
/* ==================== DATA MEMBERS ======================================= */
|
||||
private:
|
||||
/* ==================== DATA MEMBERS ======================================= */
|
||||
|
||||
double balance;
|
||||
double balance;
|
||||
|
||||
}; /* ----- end of class Account ----- */
|
||||
|
||||
#endif
|
||||
|
||||
// vim:set sts=2 sw=2 et:
|
||||
|
|
21
main.cpp
21
main.cpp
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* Filename: main.cpp
|
||||
*
|
||||
* Description:
|
||||
* Description: learning C++ [again]
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 02/08/2025 11:05:02 AM
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
* Compiler: g++
|
||||
*
|
||||
* Author: YOUR NAME (),
|
||||
* Organization:
|
||||
* Author: Vincent Batts (vbatts@hashbangbash.com)
|
||||
* Organization: HashBangBash
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
@ -24,10 +24,13 @@
|
|||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Account account(0.0);
|
||||
account.deposit(100.5); // Add some money
|
||||
account.deposit(50.25); // Add more money
|
||||
std::cout << "Current Balance: " << account.getBalance() << std::endl;
|
||||
Account account(0.0);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
account.deposit(100.5); // Add some money
|
||||
account.deposit(50.25); // Add more money
|
||||
std::cout << "Current Balance: " << account.getBalance() << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// vim:set sts=2 sw=2 et:
|
||||
|
|
Loading…
Add table
Reference in a new issue