From be891b06d065504be51d094503c654377ebc22d7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 24 Oct 2020 15:25:54 +0300 Subject: Renamed C++ folder to C++ (from CPP) --- C++/.codelite/CPP-kamen.tags | Bin 0 -> 331776 bytes C++/.codelite/CPP.session | 46 +++++++++++ C++/.codelite/subversion.conf | 5 ++ C++/.codelite/valgrind.memcheck.supp | 0 C++/BABS/BABS.mk | 126 +++++++++++++++++++++++++++++++ C++/BABS/BABS.project | 102 +++++++++++++++++++++++++ C++/BABS/BankAccount.cpp | 53 +++++++++++++ C++/BABS/BankAccount.h | 23 ++++++ C++/BABS/BankSystem.cpp | 109 ++++++++++++++++++++++++++ C++/BABS/BankSystem.h | 8 ++ C++/BABS/compile_flags.txt | 9 +++ C++/BABS/main.cpp | 35 +++++++++ C++/CPP.workspace | 14 ++++ C++/Makefile | 8 ++ C++/build-Debug/BABS/.d | 1 + C++/build-Debug/BABS/BankAccount.cpp.o | Bin 0 -> 141104 bytes C++/build-Debug/BABS/BankAccount.cpp.o.d | 3 + C++/build-Debug/BABS/BankSystem.cpp.o | Bin 0 -> 170048 bytes C++/build-Debug/BABS/BankSystem.cpp.o.d | 6 ++ C++/build-Debug/BABS/ObjectsList.txt | 1 + C++/build-Debug/BABS/main.cpp.o | Bin 0 -> 39032 bytes C++/build-Debug/BABS/main.cpp.o.d | 5 ++ C++/build-Debug/bin/BABS | Bin 0 -> 187312 bytes CPP/.codelite/CPP-kamen.tags | Bin 331776 -> 0 bytes CPP/.codelite/CPP.session | 46 ----------- CPP/.codelite/subversion.conf | 5 -- CPP/.codelite/valgrind.memcheck.supp | 0 CPP/BABS/BABS.mk | 126 ------------------------------- CPP/BABS/BABS.project | 102 ------------------------- CPP/BABS/BankAccount.cpp | 53 ------------- CPP/BABS/BankAccount.h | 23 ------ CPP/BABS/BankSystem.cpp | 109 -------------------------- CPP/BABS/BankSystem.h | 8 -- CPP/BABS/compile_flags.txt | 9 --- CPP/BABS/main.cpp | 35 --------- CPP/CPP.workspace | 14 ---- CPP/Makefile | 8 -- CPP/build-Debug/BABS/.d | 1 - CPP/build-Debug/BABS/BankAccount.cpp.o | Bin 141104 -> 0 bytes CPP/build-Debug/BABS/BankAccount.cpp.o.d | 3 - CPP/build-Debug/BABS/BankSystem.cpp.o | Bin 170048 -> 0 bytes CPP/build-Debug/BABS/BankSystem.cpp.o.d | 6 -- CPP/build-Debug/BABS/ObjectsList.txt | 1 - CPP/build-Debug/BABS/main.cpp.o | Bin 39032 -> 0 bytes CPP/build-Debug/BABS/main.cpp.o.d | 5 -- CPP/build-Debug/bin/BABS | Bin 187312 -> 0 bytes 46 files changed, 554 insertions(+), 554 deletions(-) create mode 100644 C++/.codelite/CPP-kamen.tags create mode 100644 C++/.codelite/CPP.session create mode 100644 C++/.codelite/subversion.conf create mode 100644 C++/.codelite/valgrind.memcheck.supp create mode 100644 C++/BABS/BABS.mk create mode 100644 C++/BABS/BABS.project create mode 100644 C++/BABS/BankAccount.cpp create mode 100644 C++/BABS/BankAccount.h create mode 100644 C++/BABS/BankSystem.cpp create mode 100644 C++/BABS/BankSystem.h create mode 100644 C++/BABS/compile_flags.txt create mode 100644 C++/BABS/main.cpp create mode 100644 C++/CPP.workspace create mode 100644 C++/Makefile create mode 100644 C++/build-Debug/BABS/.d create mode 100644 C++/build-Debug/BABS/BankAccount.cpp.o create mode 100644 C++/build-Debug/BABS/BankAccount.cpp.o.d create mode 100644 C++/build-Debug/BABS/BankSystem.cpp.o create mode 100644 C++/build-Debug/BABS/BankSystem.cpp.o.d create mode 100644 C++/build-Debug/BABS/ObjectsList.txt create mode 100644 C++/build-Debug/BABS/main.cpp.o create mode 100644 C++/build-Debug/BABS/main.cpp.o.d create mode 100755 C++/build-Debug/bin/BABS delete mode 100644 CPP/.codelite/CPP-kamen.tags delete mode 100644 CPP/.codelite/CPP.session delete mode 100644 CPP/.codelite/subversion.conf delete mode 100644 CPP/.codelite/valgrind.memcheck.supp delete mode 100644 CPP/BABS/BABS.mk delete mode 100644 CPP/BABS/BABS.project delete mode 100644 CPP/BABS/BankAccount.cpp delete mode 100644 CPP/BABS/BankAccount.h delete mode 100644 CPP/BABS/BankSystem.cpp delete mode 100644 CPP/BABS/BankSystem.h delete mode 100644 CPP/BABS/compile_flags.txt delete mode 100644 CPP/BABS/main.cpp delete mode 100644 CPP/CPP.workspace delete mode 100644 CPP/Makefile delete mode 100644 CPP/build-Debug/BABS/.d delete mode 100644 CPP/build-Debug/BABS/BankAccount.cpp.o delete mode 100644 CPP/build-Debug/BABS/BankAccount.cpp.o.d delete mode 100644 CPP/build-Debug/BABS/BankSystem.cpp.o delete mode 100644 CPP/build-Debug/BABS/BankSystem.cpp.o.d delete mode 100644 CPP/build-Debug/BABS/ObjectsList.txt delete mode 100644 CPP/build-Debug/BABS/main.cpp.o delete mode 100644 CPP/build-Debug/BABS/main.cpp.o.d delete mode 100755 CPP/build-Debug/bin/BABS diff --git a/C++/.codelite/CPP-kamen.tags b/C++/.codelite/CPP-kamen.tags new file mode 100644 index 0000000..50cd438 Binary files /dev/null and b/C++/.codelite/CPP-kamen.tags differ diff --git a/C++/.codelite/CPP.session b/C++/.codelite/CPP.session new file mode 100644 index 0000000..922ce71 --- /dev/null +++ b/C++/.codelite/CPP.session @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/C++/.codelite/subversion.conf b/C++/.codelite/subversion.conf new file mode 100644 index 0000000..5fdccfe --- /dev/null +++ b/C++/.codelite/subversion.conf @@ -0,0 +1,5 @@ +{ + "svn-settings": { + "m_repoPath": "" + } +} \ No newline at end of file diff --git a/C++/.codelite/valgrind.memcheck.supp b/C++/.codelite/valgrind.memcheck.supp new file mode 100644 index 0000000..e69de29 diff --git a/C++/BABS/BABS.mk b/C++/BABS/BABS.mk new file mode 100644 index 0000000..7fcbd32 --- /dev/null +++ b/C++/BABS/BABS.mk @@ -0,0 +1,126 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Debug +ProjectName :=BABS +ConfigurationName :=Debug +WorkspaceConfiguration := $(ConfigurationName) +WorkspacePath :=/home/kamen/Programming/GitHub-repos/Self-learning/CPP +ProjectPath :=/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS +IntermediateDirectory :=../build-$(ConfigurationName)/BABS +OutDir :=../build-$(ConfigurationName)/BABS +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=Kamen +Date :=27/06/20 +CodeLitePath :=/home/kamen/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=../build-$(ConfigurationName)/bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :=$(IntermediateDirectory)/ObjectsList.txt +PCHCompileFlags := +LinkOptions := +IncludePath := $(IncludeSwitch). $(IncludeSwitch). +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -g -O0 -Wall $(Preprocessors) +CFLAGS := -g -O0 -Wall $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix) ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix) ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: MakeIntermediateDirs $(OutputFile) + +$(OutputFile): ../build-$(ConfigurationName)/BABS/.d $(Objects) + @mkdir -p "../build-$(ConfigurationName)/BABS" + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @mkdir -p "../build-$(ConfigurationName)/BABS" + @mkdir -p ""../build-$(ConfigurationName)/bin"" + +../build-$(ConfigurationName)/BABS/.d: + @mkdir -p "../build-$(ConfigurationName)/BABS" + +PreBuild: + + +## +## Objects +## +../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix): main.cpp ../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath) +../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix): main.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix) -MM main.cpp + +../build-$(ConfigurationName)/BABS/main.cpp$(PreprocessSuffix): main.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/main.cpp$(PreprocessSuffix) main.cpp + +../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix): BankSystem.cpp ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankSystem.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BankSystem.cpp$(ObjectSuffix) $(IncludePath) +../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix): BankSystem.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix) -MM BankSystem.cpp + +../build-$(ConfigurationName)/BABS/BankSystem.cpp$(PreprocessSuffix): BankSystem.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(PreprocessSuffix) BankSystem.cpp + +../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix): BankAccount.cpp ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BankAccount.cpp$(ObjectSuffix) $(IncludePath) +../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix): BankAccount.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix) -MM BankAccount.cpp + +../build-$(ConfigurationName)/BABS/BankAccount.cpp$(PreprocessSuffix): BankAccount.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(PreprocessSuffix) BankAccount.cpp + + +-include ../build-$(ConfigurationName)/BABS//*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(IntermediateDirectory) + + diff --git a/C++/BABS/BABS.project b/C++/BABS/BABS.project new file mode 100644 index 0000000..5ea191d --- /dev/null +++ b/C++/BABS/BABS.project @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + diff --git a/C++/BABS/BankAccount.cpp b/C++/BABS/BankAccount.cpp new file mode 100644 index 0000000..ea02d87 --- /dev/null +++ b/C++/BABS/BankAccount.cpp @@ -0,0 +1,53 @@ +#include + +#include "BankAccount.h" + +int currId = 0; + +BankAccount::BankAccount() { + id = currId++; + balance = 0; +} + +BankAccount::BankAccount(int initialDeposit) { + id = currId++; + balance = initialDeposit; +} + + +int BankAccount::getId() { + return id; +} + +int BankAccount::getBalance() { + return balance; +} + +bool BankAccount::getCloseStatus() { + return closed; +} + + +void BankAccount::deposit(int amount) { + balance += amount; +} + +int BankAccount::withdraw(int amount) { + if (amount > balance) { + return -1; + } + balance -= amount; + return amount; +} + +std::string BankAccount::toString() { + return "ID: " + std::to_string(id) + " Balance: " + std::to_string(balance) + ((closed)?" CLOSED":""); +} + +void BankAccount::close() { + closed = true; +} + +void BankAccount::reopen() { + closed = false; +} \ No newline at end of file diff --git a/C++/BABS/BankAccount.h b/C++/BABS/BankAccount.h new file mode 100644 index 0000000..fbf808f --- /dev/null +++ b/C++/BABS/BankAccount.h @@ -0,0 +1,23 @@ +#ifndef TEST_BANKACCOUNT +#define TEST_BANKACCOUNT +#include + +class BankAccount { + int id, balance; + bool closed; + public: + BankAccount(); + BankAccount(int); + + int getId(); + int getBalance(); + bool getCloseStatus(); + + void deposit(int); + int withdraw(int); + std::string toString(); + void close(); + void reopen(); +}; + +#endif \ No newline at end of file diff --git a/C++/BABS/BankSystem.cpp b/C++/BABS/BankSystem.cpp new file mode 100644 index 0000000..0b4e726 --- /dev/null +++ b/C++/BABS/BankSystem.cpp @@ -0,0 +1,109 @@ +#include +#include + +#include "BankSystem.h" + +using namespace std; + +std::vector BADatabase; + +int getIndexFromID(int id) { + for(int i = 0; i < BADatabase.size(); i++) { + if (BADatabase[i].getId() == id) { + return i; + } + } + return -1; +} + +void listAllAccounts() { + for(BankAccount ba: BADatabase) { + cout << ba.toString() << endl; + } +} + +void openBankAccount() { + cout << "Initial balance: "; + int initBalance; + cin >> initBalance; + + BankAccount newBA(initBalance); + BADatabase.push_back(newBA); + cout << "Created new bank account with ID: " << newBA.getId() << endl; +} + +void closeBankAccount() { + cout << "Bank account ID: "; + int id; + cin >> id; + + cout << "Are you really sure you want to close bank account with ID: " << id << "? [y/n]"; + char answer; + cin >> answer; + + if (answer == 'y' || answer == 'Y') { + BADatabase[getIndexFromID(id)].close(); + } + + cout << "Bank account with ID: " << id << " is closed!" << endl; +} + +void reopenBankAccount() { + cout << "Bank account ID: "; + int id; + cin >> id; + + cout << "Are you really sure you want to reopen bank account with ID: " << id << "? [y/n]"; + char answer; + cin >> answer; + + if (answer == 'y' || answer == 'Y') { + BADatabase[getIndexFromID(id)].reopen(); + } + + cout << "Bank account with ID: " << id << " is closed!" << endl; +} + +void bankerMode() { + while(true) { + cout << "What do you want to do: [0] Exit, [1] List bank accounts, [2] Open bank account, [3] Close bank account, [4] Reopen bank account" << endl; + + int value; + cin >> value; + + switch(value) { + case 0: return; + case 1: listAllAccounts(); break; + case 2: openBankAccount(); break; + case 3: closeBankAccount(); break; + case 4: reopenBankAccount(); break; + } + } +} + +void atmMode() { + cout << "Bank accont ID: "; + int userId; + cin >> userId; + cout << endl; + + BankAccount ba = BADatabase[userId]; + if (ba.getCloseStatus()) { + cout << "Bank account is closed!" << endl; + return; + } + + while(true) { + cout << "What do you want to do: [0] Exit, [1] View balance, [2] Deposit money, [3] Withdraw money?" << endl; + + int value; + cin >> value; + + switch(value) { + case 0: return; + case 1: cout << ba.getBalance() << endl; break; + case 2: cout << "Amount to deposit: "; cin >> value; ba.deposit(value); break; + case 3: cout << "Amount to withdraw: "; cin >> value; ba.withdraw(value); break; + } + } +} \ No newline at end of file diff --git a/C++/BABS/BankSystem.h b/C++/BABS/BankSystem.h new file mode 100644 index 0000000..a593a92 --- /dev/null +++ b/C++/BABS/BankSystem.h @@ -0,0 +1,8 @@ +#ifndef BA-BANK_SYSTEM-BANK_SYSTEM +#define BA-BANK_SYSTEM-BANK_SYSTEM +#include "BankAccount.h" + +void bankerMode(); +void atmMode(); + +#endif \ No newline at end of file diff --git a/C++/BABS/compile_flags.txt b/C++/BABS/compile_flags.txt new file mode 100644 index 0000000..8ce13f3 --- /dev/null +++ b/C++/BABS/compile_flags.txt @@ -0,0 +1,9 @@ +-I/usr/include/c++/7 +-I/usr/include/x86_64-linux-gnu/c++/7 +-I/usr/include/c++/7/backward +-I/usr/lib/gcc/x86_64-linux-gnu/7/include +-I/usr/local/include +-I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed +-I/usr/include/x86_64-linux-gnu +-I/usr/include +-I/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS diff --git a/C++/BABS/main.cpp b/C++/BABS/main.cpp new file mode 100644 index 0000000..717e0dd --- /dev/null +++ b/C++/BABS/main.cpp @@ -0,0 +1,35 @@ +#include + +#include "BankSystem.h" + +#define MODE_SPACER "------------------------------------------------------------" + +using namespace std; + +int main() +{ + cout << "Welcome to BA banking system!" << endl << endl; + while(true) { + cout << "Mode: Atm/Banker/Exit "; + char inValue; + cin >> inValue; + + if (inValue == 'e' || inValue == 'E' || inValue == '0') { + return 0; + } + + if (inValue == 'b' || inValue == 'B') { + cout << MODE_SPACER << endl; + bankerMode(); + cout << MODE_SPACER << endl; + } + else { + cout << MODE_SPACER << endl; + atmMode(); + cout << MODE_SPACER << endl; + } + } + cout << "Goodbye!" << endl << endl; + + return 0; +} \ No newline at end of file diff --git a/C++/CPP.workspace b/C++/CPP.workspace new file mode 100644 index 0000000..b02559c --- /dev/null +++ b/C++/CPP.workspace @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/C++/Makefile b/C++/Makefile new file mode 100644 index 0000000..4f7fd06 --- /dev/null +++ b/C++/Makefile @@ -0,0 +1,8 @@ +.PHONY: clean All + +All: + @echo "----------Building project:[ BABS - Debug ]----------" + @cd "BABS" && "$(MAKE)" -f "BABS.mk" +clean: + @echo "----------Cleaning project:[ BABS - Debug ]----------" + @cd "BABS" && "$(MAKE)" -f "BABS.mk" clean diff --git a/C++/build-Debug/BABS/.d b/C++/build-Debug/BABS/.d new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/C++/build-Debug/BABS/.d @@ -0,0 +1 @@ + diff --git a/C++/build-Debug/BABS/BankAccount.cpp.o b/C++/build-Debug/BABS/BankAccount.cpp.o new file mode 100644 index 0000000..17b532d Binary files /dev/null and b/C++/build-Debug/BABS/BankAccount.cpp.o differ diff --git a/C++/build-Debug/BABS/BankAccount.cpp.o.d b/C++/build-Debug/BABS/BankAccount.cpp.o.d new file mode 100644 index 0000000..a37af18 --- /dev/null +++ b/C++/build-Debug/BABS/BankAccount.cpp.o.d @@ -0,0 +1,3 @@ +../build-Debug/BABS/BankAccount.cpp.o: BankAccount.cpp BankAccount.h + +BankAccount.h: diff --git a/C++/build-Debug/BABS/BankSystem.cpp.o b/C++/build-Debug/BABS/BankSystem.cpp.o new file mode 100644 index 0000000..8b097da Binary files /dev/null and b/C++/build-Debug/BABS/BankSystem.cpp.o differ diff --git a/C++/build-Debug/BABS/BankSystem.cpp.o.d b/C++/build-Debug/BABS/BankSystem.cpp.o.d new file mode 100644 index 0000000..97e857b --- /dev/null +++ b/C++/build-Debug/BABS/BankSystem.cpp.o.d @@ -0,0 +1,6 @@ +../build-Debug/BABS/BankSystem.cpp.o: BankSystem.cpp BankSystem.h \ + BankAccount.h + +BankSystem.h: + +BankAccount.h: diff --git a/C++/build-Debug/BABS/ObjectsList.txt b/C++/build-Debug/BABS/ObjectsList.txt new file mode 100644 index 0000000..0404e94 --- /dev/null +++ b/C++/build-Debug/BABS/ObjectsList.txt @@ -0,0 +1 @@ +../build-Debug/BABS/main.cpp.o ../build-Debug/BABS/BankSystem.cpp.o ../build-Debug/BABS/BankAccount.cpp.o diff --git a/C++/build-Debug/BABS/main.cpp.o b/C++/build-Debug/BABS/main.cpp.o new file mode 100644 index 0000000..cb8fbed Binary files /dev/null and b/C++/build-Debug/BABS/main.cpp.o differ diff --git a/C++/build-Debug/BABS/main.cpp.o.d b/C++/build-Debug/BABS/main.cpp.o.d new file mode 100644 index 0000000..574b935 --- /dev/null +++ b/C++/build-Debug/BABS/main.cpp.o.d @@ -0,0 +1,5 @@ +../build-Debug/BABS/main.cpp.o: main.cpp BankSystem.h BankAccount.h + +BankSystem.h: + +BankAccount.h: diff --git a/C++/build-Debug/bin/BABS b/C++/build-Debug/bin/BABS new file mode 100755 index 0000000..15c0a8b Binary files /dev/null and b/C++/build-Debug/bin/BABS differ diff --git a/CPP/.codelite/CPP-kamen.tags b/CPP/.codelite/CPP-kamen.tags deleted file mode 100644 index 50cd438..0000000 Binary files a/CPP/.codelite/CPP-kamen.tags and /dev/null differ diff --git a/CPP/.codelite/CPP.session b/CPP/.codelite/CPP.session deleted file mode 100644 index 922ce71..0000000 --- a/CPP/.codelite/CPP.session +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CPP/.codelite/subversion.conf b/CPP/.codelite/subversion.conf deleted file mode 100644 index 5fdccfe..0000000 --- a/CPP/.codelite/subversion.conf +++ /dev/null @@ -1,5 +0,0 @@ -{ - "svn-settings": { - "m_repoPath": "" - } -} \ No newline at end of file diff --git a/CPP/.codelite/valgrind.memcheck.supp b/CPP/.codelite/valgrind.memcheck.supp deleted file mode 100644 index e69de29..0000000 diff --git a/CPP/BABS/BABS.mk b/CPP/BABS/BABS.mk deleted file mode 100644 index 7fcbd32..0000000 --- a/CPP/BABS/BABS.mk +++ /dev/null @@ -1,126 +0,0 @@ -## -## Auto Generated makefile by CodeLite IDE -## any manual changes will be erased -## -## Debug -ProjectName :=BABS -ConfigurationName :=Debug -WorkspaceConfiguration := $(ConfigurationName) -WorkspacePath :=/home/kamen/Programming/GitHub-repos/Self-learning/CPP -ProjectPath :=/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS -IntermediateDirectory :=../build-$(ConfigurationName)/BABS -OutDir :=../build-$(ConfigurationName)/BABS -CurrentFileName := -CurrentFilePath := -CurrentFileFullPath := -User :=Kamen -Date :=27/06/20 -CodeLitePath :=/home/kamen/.codelite -LinkerName :=/usr/bin/g++ -SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC -ObjectSuffix :=.o -DependSuffix :=.o.d -PreprocessSuffix :=.i -DebugSwitch :=-g -IncludeSwitch :=-I -LibrarySwitch :=-l -OutputSwitch :=-o -LibraryPathSwitch :=-L -PreprocessorSwitch :=-D -SourceSwitch :=-c -OutputFile :=../build-$(ConfigurationName)/bin/$(ProjectName) -Preprocessors := -ObjectSwitch :=-o -ArchiveOutputSwitch := -PreprocessOnlySwitch :=-E -ObjectsFileList :=$(IntermediateDirectory)/ObjectsList.txt -PCHCompileFlags := -LinkOptions := -IncludePath := $(IncludeSwitch). $(IncludeSwitch). -IncludePCH := -RcIncludePath := -Libs := -ArLibs := -LibPath := $(LibraryPathSwitch). - -## -## Common variables -## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables -## -AR := /usr/bin/ar rcu -CXX := /usr/bin/g++ -CC := /usr/bin/gcc -CXXFLAGS := -g -O0 -Wall $(Preprocessors) -CFLAGS := -g -O0 -Wall $(Preprocessors) -ASFLAGS := -AS := /usr/bin/as - - -## -## User defined environment variables -## -CodeLiteDir:=/usr/share/codelite -Objects0=../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix) ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix) ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix) - - - -Objects=$(Objects0) - -## -## Main Build Targets -## -.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs -all: MakeIntermediateDirs $(OutputFile) - -$(OutputFile): ../build-$(ConfigurationName)/BABS/.d $(Objects) - @mkdir -p "../build-$(ConfigurationName)/BABS" - @echo "" > $(IntermediateDirectory)/.d - @echo $(Objects0) > $(ObjectsFileList) - $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) - -MakeIntermediateDirs: - @mkdir -p "../build-$(ConfigurationName)/BABS" - @mkdir -p ""../build-$(ConfigurationName)/bin"" - -../build-$(ConfigurationName)/BABS/.d: - @mkdir -p "../build-$(ConfigurationName)/BABS" - -PreBuild: - - -## -## Objects -## -../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix): main.cpp ../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath) -../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix): main.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/main.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/main.cpp$(DependSuffix) -MM main.cpp - -../build-$(ConfigurationName)/BABS/main.cpp$(PreprocessSuffix): main.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/main.cpp$(PreprocessSuffix) main.cpp - -../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix): BankSystem.cpp ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankSystem.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BankSystem.cpp$(ObjectSuffix) $(IncludePath) -../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix): BankSystem.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/BankSystem.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/BankSystem.cpp$(DependSuffix) -MM BankSystem.cpp - -../build-$(ConfigurationName)/BABS/BankSystem.cpp$(PreprocessSuffix): BankSystem.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/BankSystem.cpp$(PreprocessSuffix) BankSystem.cpp - -../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix): BankAccount.cpp ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BankAccount.cpp$(ObjectSuffix) $(IncludePath) -../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix): BankAccount.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../build-$(ConfigurationName)/BABS/BankAccount.cpp$(ObjectSuffix) -MF../build-$(ConfigurationName)/BABS/BankAccount.cpp$(DependSuffix) -MM BankAccount.cpp - -../build-$(ConfigurationName)/BABS/BankAccount.cpp$(PreprocessSuffix): BankAccount.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../build-$(ConfigurationName)/BABS/BankAccount.cpp$(PreprocessSuffix) BankAccount.cpp - - --include ../build-$(ConfigurationName)/BABS//*$(DependSuffix) -## -## Clean -## -clean: - $(RM) -r $(IntermediateDirectory) - - diff --git a/CPP/BABS/BABS.project b/CPP/BABS/BABS.project deleted file mode 100644 index 5ea191d..0000000 --- a/CPP/BABS/BABS.project +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - - - diff --git a/CPP/BABS/BankAccount.cpp b/CPP/BABS/BankAccount.cpp deleted file mode 100644 index ea02d87..0000000 --- a/CPP/BABS/BankAccount.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include - -#include "BankAccount.h" - -int currId = 0; - -BankAccount::BankAccount() { - id = currId++; - balance = 0; -} - -BankAccount::BankAccount(int initialDeposit) { - id = currId++; - balance = initialDeposit; -} - - -int BankAccount::getId() { - return id; -} - -int BankAccount::getBalance() { - return balance; -} - -bool BankAccount::getCloseStatus() { - return closed; -} - - -void BankAccount::deposit(int amount) { - balance += amount; -} - -int BankAccount::withdraw(int amount) { - if (amount > balance) { - return -1; - } - balance -= amount; - return amount; -} - -std::string BankAccount::toString() { - return "ID: " + std::to_string(id) + " Balance: " + std::to_string(balance) + ((closed)?" CLOSED":""); -} - -void BankAccount::close() { - closed = true; -} - -void BankAccount::reopen() { - closed = false; -} \ No newline at end of file diff --git a/CPP/BABS/BankAccount.h b/CPP/BABS/BankAccount.h deleted file mode 100644 index fbf808f..0000000 --- a/CPP/BABS/BankAccount.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TEST_BANKACCOUNT -#define TEST_BANKACCOUNT -#include - -class BankAccount { - int id, balance; - bool closed; - public: - BankAccount(); - BankAccount(int); - - int getId(); - int getBalance(); - bool getCloseStatus(); - - void deposit(int); - int withdraw(int); - std::string toString(); - void close(); - void reopen(); -}; - -#endif \ No newline at end of file diff --git a/CPP/BABS/BankSystem.cpp b/CPP/BABS/BankSystem.cpp deleted file mode 100644 index 0b4e726..0000000 --- a/CPP/BABS/BankSystem.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include -#include - -#include "BankSystem.h" - -using namespace std; - -std::vector BADatabase; - -int getIndexFromID(int id) { - for(int i = 0; i < BADatabase.size(); i++) { - if (BADatabase[i].getId() == id) { - return i; - } - } - return -1; -} - -void listAllAccounts() { - for(BankAccount ba: BADatabase) { - cout << ba.toString() << endl; - } -} - -void openBankAccount() { - cout << "Initial balance: "; - int initBalance; - cin >> initBalance; - - BankAccount newBA(initBalance); - BADatabase.push_back(newBA); - cout << "Created new bank account with ID: " << newBA.getId() << endl; -} - -void closeBankAccount() { - cout << "Bank account ID: "; - int id; - cin >> id; - - cout << "Are you really sure you want to close bank account with ID: " << id << "? [y/n]"; - char answer; - cin >> answer; - - if (answer == 'y' || answer == 'Y') { - BADatabase[getIndexFromID(id)].close(); - } - - cout << "Bank account with ID: " << id << " is closed!" << endl; -} - -void reopenBankAccount() { - cout << "Bank account ID: "; - int id; - cin >> id; - - cout << "Are you really sure you want to reopen bank account with ID: " << id << "? [y/n]"; - char answer; - cin >> answer; - - if (answer == 'y' || answer == 'Y') { - BADatabase[getIndexFromID(id)].reopen(); - } - - cout << "Bank account with ID: " << id << " is closed!" << endl; -} - -void bankerMode() { - while(true) { - cout << "What do you want to do: [0] Exit, [1] List bank accounts, [2] Open bank account, [3] Close bank account, [4] Reopen bank account" << endl; - - int value; - cin >> value; - - switch(value) { - case 0: return; - case 1: listAllAccounts(); break; - case 2: openBankAccount(); break; - case 3: closeBankAccount(); break; - case 4: reopenBankAccount(); break; - } - } -} - -void atmMode() { - cout << "Bank accont ID: "; - int userId; - cin >> userId; - cout << endl; - - BankAccount ba = BADatabase[userId]; - if (ba.getCloseStatus()) { - cout << "Bank account is closed!" << endl; - return; - } - - while(true) { - cout << "What do you want to do: [0] Exit, [1] View balance, [2] Deposit money, [3] Withdraw money?" << endl; - - int value; - cin >> value; - - switch(value) { - case 0: return; - case 1: cout << ba.getBalance() << endl; break; - case 2: cout << "Amount to deposit: "; cin >> value; ba.deposit(value); break; - case 3: cout << "Amount to withdraw: "; cin >> value; ba.withdraw(value); break; - } - } -} \ No newline at end of file diff --git a/CPP/BABS/BankSystem.h b/CPP/BABS/BankSystem.h deleted file mode 100644 index a593a92..0000000 --- a/CPP/BABS/BankSystem.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef BA-BANK_SYSTEM-BANK_SYSTEM -#define BA-BANK_SYSTEM-BANK_SYSTEM -#include "BankAccount.h" - -void bankerMode(); -void atmMode(); - -#endif \ No newline at end of file diff --git a/CPP/BABS/compile_flags.txt b/CPP/BABS/compile_flags.txt deleted file mode 100644 index 8ce13f3..0000000 --- a/CPP/BABS/compile_flags.txt +++ /dev/null @@ -1,9 +0,0 @@ --I/usr/include/c++/7 --I/usr/include/x86_64-linux-gnu/c++/7 --I/usr/include/c++/7/backward --I/usr/lib/gcc/x86_64-linux-gnu/7/include --I/usr/local/include --I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed --I/usr/include/x86_64-linux-gnu --I/usr/include --I/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS diff --git a/CPP/BABS/main.cpp b/CPP/BABS/main.cpp deleted file mode 100644 index 717e0dd..0000000 --- a/CPP/BABS/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -#include "BankSystem.h" - -#define MODE_SPACER "------------------------------------------------------------" - -using namespace std; - -int main() -{ - cout << "Welcome to BA banking system!" << endl << endl; - while(true) { - cout << "Mode: Atm/Banker/Exit "; - char inValue; - cin >> inValue; - - if (inValue == 'e' || inValue == 'E' || inValue == '0') { - return 0; - } - - if (inValue == 'b' || inValue == 'B') { - cout << MODE_SPACER << endl; - bankerMode(); - cout << MODE_SPACER << endl; - } - else { - cout << MODE_SPACER << endl; - atmMode(); - cout << MODE_SPACER << endl; - } - } - cout << "Goodbye!" << endl << endl; - - return 0; -} \ No newline at end of file diff --git a/CPP/CPP.workspace b/CPP/CPP.workspace deleted file mode 100644 index b02559c..0000000 --- a/CPP/CPP.workspace +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/CPP/Makefile b/CPP/Makefile deleted file mode 100644 index 4f7fd06..0000000 --- a/CPP/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: clean All - -All: - @echo "----------Building project:[ BABS - Debug ]----------" - @cd "BABS" && "$(MAKE)" -f "BABS.mk" -clean: - @echo "----------Cleaning project:[ BABS - Debug ]----------" - @cd "BABS" && "$(MAKE)" -f "BABS.mk" clean diff --git a/CPP/build-Debug/BABS/.d b/CPP/build-Debug/BABS/.d deleted file mode 100644 index 8b13789..0000000 --- a/CPP/build-Debug/BABS/.d +++ /dev/null @@ -1 +0,0 @@ - diff --git a/CPP/build-Debug/BABS/BankAccount.cpp.o b/CPP/build-Debug/BABS/BankAccount.cpp.o deleted file mode 100644 index 17b532d..0000000 Binary files a/CPP/build-Debug/BABS/BankAccount.cpp.o and /dev/null differ diff --git a/CPP/build-Debug/BABS/BankAccount.cpp.o.d b/CPP/build-Debug/BABS/BankAccount.cpp.o.d deleted file mode 100644 index a37af18..0000000 --- a/CPP/build-Debug/BABS/BankAccount.cpp.o.d +++ /dev/null @@ -1,3 +0,0 @@ -../build-Debug/BABS/BankAccount.cpp.o: BankAccount.cpp BankAccount.h - -BankAccount.h: diff --git a/CPP/build-Debug/BABS/BankSystem.cpp.o b/CPP/build-Debug/BABS/BankSystem.cpp.o deleted file mode 100644 index 8b097da..0000000 Binary files a/CPP/build-Debug/BABS/BankSystem.cpp.o and /dev/null differ diff --git a/CPP/build-Debug/BABS/BankSystem.cpp.o.d b/CPP/build-Debug/BABS/BankSystem.cpp.o.d deleted file mode 100644 index 97e857b..0000000 --- a/CPP/build-Debug/BABS/BankSystem.cpp.o.d +++ /dev/null @@ -1,6 +0,0 @@ -../build-Debug/BABS/BankSystem.cpp.o: BankSystem.cpp BankSystem.h \ - BankAccount.h - -BankSystem.h: - -BankAccount.h: diff --git a/CPP/build-Debug/BABS/ObjectsList.txt b/CPP/build-Debug/BABS/ObjectsList.txt deleted file mode 100644 index 0404e94..0000000 --- a/CPP/build-Debug/BABS/ObjectsList.txt +++ /dev/null @@ -1 +0,0 @@ -../build-Debug/BABS/main.cpp.o ../build-Debug/BABS/BankSystem.cpp.o ../build-Debug/BABS/BankAccount.cpp.o diff --git a/CPP/build-Debug/BABS/main.cpp.o b/CPP/build-Debug/BABS/main.cpp.o deleted file mode 100644 index cb8fbed..0000000 Binary files a/CPP/build-Debug/BABS/main.cpp.o and /dev/null differ diff --git a/CPP/build-Debug/BABS/main.cpp.o.d b/CPP/build-Debug/BABS/main.cpp.o.d deleted file mode 100644 index 574b935..0000000 --- a/CPP/build-Debug/BABS/main.cpp.o.d +++ /dev/null @@ -1,5 +0,0 @@ -../build-Debug/BABS/main.cpp.o: main.cpp BankSystem.h BankAccount.h - -BankSystem.h: - -BankAccount.h: diff --git a/CPP/build-Debug/bin/BABS b/CPP/build-Debug/bin/BABS deleted file mode 100755 index 15c0a8b..0000000 Binary files a/CPP/build-Debug/bin/BABS and /dev/null differ -- cgit v1.2.3