From 768916ff0d15c9ffc892d35543951079f7cc01cf Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 10 Feb 2025 13:59:55 -0500 Subject: [PATCH] *.cpp *.h: vim settings for 2-spaces instead of tabs Signed-off-by: Vincent Batts --- account.cpp | 12 ++++++------ account.h | 40 +++++++++++++++++++++------------------- main.cpp | 21 ++++++++++++--------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/account.cpp b/account.cpp index b4db4ca..7e1b59b 100644 --- a/account.cpp +++ b/account.cpp @@ -1,24 +1,24 @@ #include -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: diff --git a/account.h b/account.h index 5631f7c..e8054bc 100644 --- a/account.h +++ b/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: diff --git a/main.cpp b/main.cpp index 204e693..d4cffa6 100644 --- a/main.cpp +++ b/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: