|
@ -1,13 +1,5 @@ |
|
|
#include "CreateCustomer.h" |
|
|
|
|
|
|
|
|
#include "createCustomer.h" |
|
|
/*Code written by Julius Philipp Engel, fdai7057*/ |
|
|
/*Code written by Julius Philipp Engel, fdai7057*/ |
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
int main() |
|
|
|
|
|
{ |
|
|
|
|
|
collectCustomerProperties(); |
|
|
|
|
|
} |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
int generateID() |
|
|
int generateID() |
|
|
{ |
|
|
{ |
|
|
srand(clock()); |
|
|
srand(clock()); |
|
@ -27,6 +19,7 @@ void collectCustomerProperties() |
|
|
int letterMaximum = 15; |
|
|
int letterMaximum = 15; |
|
|
char userInput=' '; |
|
|
char userInput=' '; |
|
|
bool inputTooLong = false; |
|
|
bool inputTooLong = false; |
|
|
|
|
|
fflush(stdin); |
|
|
printf("To create a new user, enter the information required below.\n"); |
|
|
printf("To create a new user, enter the information required below.\n"); |
|
|
printf("Enter forename (max. 15 letters):\n"); |
|
|
printf("Enter forename (max. 15 letters):\n"); |
|
|
while(letterCounter<letterMaximum && (userInput=getchar())!='\n'){ |
|
|
while(letterCounter<letterMaximum && (userInput=getchar())!='\n'){ |
|
@ -61,10 +54,10 @@ void collectCustomerProperties() |
|
|
letterCounter = 0; |
|
|
letterCounter = 0; |
|
|
} |
|
|
} |
|
|
printf("Enter password (max. 20 letters):\n"); |
|
|
printf("Enter password (max. 20 letters):\n"); |
|
|
while(letterCounter<letterMaximum && (userInput=getchar())!='\n'){ |
|
|
|
|
|
|
|
|
while(letterCounter<=(letterMaximum+5) && (userInput=getchar())!='\n'){ |
|
|
*(instance.password+letterCounter) = userInput; |
|
|
*(instance.password+letterCounter) = userInput; |
|
|
++letterCounter; |
|
|
++letterCounter; |
|
|
if(letterCounter>=letterMaximum){ |
|
|
|
|
|
|
|
|
if(letterCounter>=letterMaximum+5){ |
|
|
inputTooLong = true; |
|
|
inputTooLong = true; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |