|
|
@ -67,17 +67,33 @@ unsigned int power(unsigned int base, unsigned int exponent){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool everyCharacterIsDigit(char *string) |
|
|
|
{ |
|
|
|
bool onlyDigits = true; |
|
|
|
for(int i=0;*(string+i)!='\0';++i){ |
|
|
|
if(*(string+i)<'0'||*(string+i)>'9'){ |
|
|
|
onlyDigits = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return onlyDigits; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unsigned int toUnsignedInteger(char *ID) |
|
|
|
{ |
|
|
|
if(everyCharacterIsDigit(ID)){ |
|
|
|
unsigned int result = 0; |
|
|
|
int IDLength = strlen(ID); |
|
|
|
for(int i=0, j = IDLength - 1;i<IDLength;++i,--j){ |
|
|
|
result += (*(ID+j) - '0') * power(10,i); |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char *generateCheckString(unsigned int customerID, char *customerPassword) |
|
|
|
{ |
|
|
|
char *IDString = to_string(customerID); |
|
|
|