From 77e31ad441df2bb901656e046a06d3a565239bf9 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Wed, 18 Jan 2023 17:25:21 +0100 Subject: [PATCH] implementation of to_string() --- build-project.sh | 5 ----- src/CustomerProperties.h | 5 +++++ src/StringManipulation.c | 24 ++++++++++++++++++++++++ src/StringManipulation.h | 3 +++ src/main.c | 7 ------- team.md | 9 --------- 6 files changed, 32 insertions(+), 21 deletions(-) delete mode 100755 build-project.sh create mode 100644 src/CustomerProperties.h create mode 100644 src/StringManipulation.c create mode 100644 src/StringManipulation.h delete mode 100644 src/main.c delete mode 100644 team.md diff --git a/build-project.sh b/build-project.sh deleted file mode 100755 index fbd6ce9..0000000 --- a/build-project.sh +++ /dev/null @@ -1,5 +0,0 @@ -clear -cd src/ -gcc main.c -./a.out -rm a.out diff --git a/src/CustomerProperties.h b/src/CustomerProperties.h new file mode 100644 index 0000000..e2ba317 --- /dev/null +++ b/src/CustomerProperties.h @@ -0,0 +1,5 @@ +typedef struct Customer{ + int ID; + char *forename,*surname,*password; + float balance; +}customer_t; diff --git a/src/StringManipulation.c b/src/StringManipulation.c new file mode 100644 index 0000000..2863f93 --- /dev/null +++ b/src/StringManipulation.c @@ -0,0 +1,24 @@ +#include "StringManipulation.h" +/*Code written by Julius Philipp Engel, fdai7057*/ +char *to_string(int number) +{ + if(number==0) + { + return "0\0"; + } + else + { + int cpy = number, len = 0; + while(number>0){ + ++len; + number /= 10; + } + char *str = calloc(len+1, sizeof(char)); + for(int i=0,j=len-1;i +#include +char *to_string(int); diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 2e0147f..0000000 --- a/src/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() -{ - - return 0; -} diff --git a/team.md b/team.md deleted file mode 100644 index 02580e9..0000000 --- a/team.md +++ /dev/null @@ -1,9 +0,0 @@ -# Bankmanagement-System - -- Can Hacioglu, Fdlt3817 -- Atharva Kishor Naik, fdai7514 -- Julius Philipp Engel, fdai7057 -- Shivam Chaudhary, fdlt3781 -- Mohamed Yahya Dahi, fdai6618 -- Haytham Daoula, fdai7207 -