diff options
Diffstat (limited to 'C++')
| -rw-r--r-- | C++/.codelite/CPP-kamen.tags | bin | 0 -> 331776 bytes | |||
| -rw-r--r-- | C++/.codelite/CPP.session | 46 | ||||
| -rw-r--r-- | C++/.codelite/subversion.conf | 5 | ||||
| -rw-r--r-- | C++/.codelite/valgrind.memcheck.supp | 0 | ||||
| -rw-r--r-- | C++/BABS/BABS.mk | 126 | ||||
| -rw-r--r-- | C++/BABS/BABS.project | 102 | ||||
| -rw-r--r-- | C++/BABS/BankAccount.cpp | 53 | ||||
| -rw-r--r-- | C++/BABS/BankAccount.h | 23 | ||||
| -rw-r--r-- | C++/BABS/BankSystem.cpp | 109 | ||||
| -rw-r--r-- | C++/BABS/BankSystem.h | 8 | ||||
| -rw-r--r-- | C++/BABS/compile_flags.txt | 9 | ||||
| -rw-r--r-- | C++/BABS/main.cpp | 35 | ||||
| -rw-r--r-- | C++/CPP.workspace | 14 | ||||
| -rw-r--r-- | C++/Makefile | 8 | ||||
| -rw-r--r-- | C++/build-Debug/BABS/.d | 1 | ||||
| -rw-r--r-- | C++/build-Debug/BABS/BankAccount.cpp.o | bin | 0 -> 141104 bytes | |||
| -rw-r--r-- | C++/build-Debug/BABS/BankAccount.cpp.o.d | 3 | ||||
| -rw-r--r-- | C++/build-Debug/BABS/BankSystem.cpp.o | bin | 0 -> 170048 bytes | |||
| -rw-r--r-- | C++/build-Debug/BABS/BankSystem.cpp.o.d | 6 | ||||
| -rw-r--r-- | C++/build-Debug/BABS/ObjectsList.txt | 1 | ||||
| -rw-r--r-- | C++/build-Debug/BABS/main.cpp.o | bin | 0 -> 39032 bytes | |||
| -rw-r--r-- | C++/build-Debug/BABS/main.cpp.o.d | 5 | ||||
| -rwxr-xr-x | C++/build-Debug/bin/BABS | bin | 0 -> 187312 bytes |
23 files changed, 554 insertions, 0 deletions
diff --git a/C++/.codelite/CPP-kamen.tags b/C++/.codelite/CPP-kamen.tags Binary files differnew file mode 100644 index 0000000..50cd438 --- /dev/null +++ b/C++/.codelite/CPP-kamen.tags 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Session Name="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/CPP.workspace"> + <int Value="4" Name="m_selectedTab"/> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/CPP.workspace" Name="m_workspaceName"/> + <TabInfoArray Name="TabInfoArray"> + <TabInfo> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/main.cpp" Name="FileName"/> + <int Value="0" Name="FirstVisibleLine"/> + <int Value="0" Name="CurrentLine"/> + <wxArrayString Name="Bookmarks"/> + <IntVector Name="CollapsedFolds"/> + </TabInfo> + <TabInfo> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankAccount.h" Name="FileName"/> + <int Value="16" Name="FirstVisibleLine"/> + <int Value="17" Name="CurrentLine"/> + <wxArrayString Name="Bookmarks"/> + <IntVector Name="CollapsedFolds"/> + </TabInfo> + <TabInfo> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankAccount.cpp" Name="FileName"/> + <int Value="5" Name="FirstVisibleLine"/> + <int Value="51" Name="CurrentLine"/> + <wxArrayString Name="Bookmarks"/> + <IntVector Name="CollapsedFolds"/> + </TabInfo> + <TabInfo> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankSystem.h" Name="FileName"/> + <int Value="0" Name="FirstVisibleLine"/> + <int Value="0" Name="CurrentLine"/> + <wxArrayString Name="Bookmarks"/> + <IntVector Name="CollapsedFolds"/> + </TabInfo> + <TabInfo> + <wxString Value="/home/kamen/Programming/GitHub-repos/Self-learning/CPP/BABS/BankSystem.cpp" Name="FileName"/> + <int Value="75" Name="FirstVisibleLine"/> + <int Value="60" Name="CurrentLine"/> + <wxArrayString Name="Bookmarks"/> + <IntVector Name="CollapsedFolds"/> + </TabInfo> + </TabInfoArray> + <SerializedObject Name="m_breakpoints"> + <long Value="0" Name="Count"/> + </SerializedObject> + <wxString Value="*.c;*.cpp;*.cxx;*.cc;*.h;*.hpp;*.inc;*.mm;*.m;*.xrc;*.plist;*.txt" Name="m_findInFilesMask"/> +</Session> 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 --- /dev/null +++ b/C++/.codelite/valgrind.memcheck.supp 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CodeLite_Project Name="BABS" Version="11000" InternalType="Console"> + <Description/> + <Dependencies/> + <Settings Type="Executable"> + <GlobalSettings> + <Compiler Options="" C_Options="" Assembler=""> + <IncludePath Value="."/> + </Compiler> + <Linker Options=""> + <LibraryPath Value="."/> + </Linker> + <ResourceCompiler Options=""/> + </GlobalSettings> + <Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> + <Compiler Options="-g;-O0;-Wall" C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> + <IncludePath Value="."/> + </Compiler> + <Linker Options="" Required="yes"/> + <ResourceCompiler Options="" Required="no"/> + <General OutputFile="$(ProjectName)" IntermediateDirectory="" Command="$(WorkspacePath)/build-$(WorkspaceConfiguration)/bin/$(OutputFile)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/build-$(WorkspaceConfiguration)/lib" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> + <BuildSystem Name="CodeLite Make Generator"/> + <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> + <![CDATA[]]> + </Environment> + <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> + <DebuggerSearchPaths/> + <PostConnectCommands/> + <StartupCommands/> + </Debugger> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="no"> + <RebuildCommand/> + <CleanCommand/> + <BuildCommand/> + <PreprocessFileCommand/> + <SingleFileCommand/> + <MakefileGenerationCommand/> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory/> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild/> + <CustomPreBuild/> + </AdditionalRules> + <Completion EnableCpp11="no" EnableCpp14="no"> + <ClangCmpFlagsC/> + <ClangCmpFlags/> + <ClangPP/> + <SearchPaths/> + </Completion> + </Configuration> + <Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> + <Compiler Options="-O2;-Wall" C_Options="-O2;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"> + <IncludePath Value="."/> + <Preprocessor Value="NDEBUG"/> + </Compiler> + <Linker Options="" Required="yes"/> + <ResourceCompiler Options="" Required="no"/> + <General OutputFile="$(ProjectName)" IntermediateDirectory="" Command="$(WorkspacePath)/build-$(WorkspaceConfiguration)/bin/$(OutputFile)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/build-$(WorkspaceConfiguration)/lib" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/> + <BuildSystem Name="CodeLite Make Generator"/> + <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>"> + <![CDATA[]]> + </Environment> + <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no"> + <DebuggerSearchPaths/> + <PostConnectCommands/> + <StartupCommands/> + </Debugger> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="no"> + <RebuildCommand/> + <CleanCommand/> + <BuildCommand/> + <PreprocessFileCommand/> + <SingleFileCommand/> + <MakefileGenerationCommand/> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory/> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild/> + <CustomPreBuild/> + </AdditionalRules> + <Completion EnableCpp11="no" EnableCpp14="no"> + <ClangCmpFlagsC/> + <ClangCmpFlags/> + <ClangPP/> + <SearchPaths/> + </Completion> + </Configuration> + </Settings> + <VirtualDirectory Name="src"> + <File Name="BankAccount.h"/> + <File Name="BankSystem.h"/> + <File Name="BankAccount.cpp"/> + <File Name="BankSystem.cpp"/> + <File Name="main.cpp"/> + </VirtualDirectory> +</CodeLite_Project> 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 <string> + +#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 <string> + +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 <iostream> +#include <vector> + +#include "BankSystem.h" + +using namespace std; + +std::vector<BankAccount> 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 <iostream> + +#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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CodeLite_Workspace Name="CPP" Database="" Version="10000"> + <Project Name="BABS" Path="BABS/BABS.project" Active="Yes"/> + <BuildMatrix> + <WorkspaceConfiguration Name="Debug" Selected="yes"> + <Environment/> + <Project Name="BABS" ConfigName="Debug"/> + </WorkspaceConfiguration> + <WorkspaceConfiguration Name="Release" Selected="yes"> + <Environment/> + <Project Name="BABS" ConfigName="Release"/> + </WorkspaceConfiguration> + </BuildMatrix> +</CodeLite_Workspace> 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 Binary files differnew file mode 100644 index 0000000..17b532d --- /dev/null +++ b/C++/build-Debug/BABS/BankAccount.cpp.o 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 Binary files differnew file mode 100644 index 0000000..8b097da --- /dev/null +++ b/C++/build-Debug/BABS/BankSystem.cpp.o 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 Binary files differnew file mode 100644 index 0000000..cb8fbed --- /dev/null +++ b/C++/build-Debug/BABS/main.cpp.o 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 Binary files differnew file mode 100755 index 0000000..15c0a8b --- /dev/null +++ b/C++/build-Debug/bin/BABS |
