online-caro.cpp
/*
* Validate request from client; Count total characters and total digits.
* @param     request     [IN] client request.
* @param     totalChars     [OUT] Total characters
* @param     totalDigits     [OUT] Total digits.
* @return     bool     only return true in case request is valid.
*/
Validate request from client; Count total characters and total digits.
Validate request from client ; Count total characters and total digits .
bool isValidRequest(char* request, int* totalChars, int* totalDigits) {
	char* args = request;
	for (int i = 0; i < strlen(args); i++) {
		if ((int('A') <= int(toupper(args[i])) && int(toupper(args[i])) <= int('Z'))) *totalChars = *totalChars + 1;
		else if ((int('0') <= int(args[i]) && int(args[i]) <= int('9'))) *totalDigits = *totalDigits + 1;
		else return false;
	}
	return true;
}
bool isValidRequest ( char * request , int * totalChars , int * totalDigits ) { char * args = request ; for ( int i = 0 ; i < strlen ( args ) ; i ++ ) { if ( ( int ( ' ' ) <= int ( toupper ( args [ i ] ) ) && int ( toupper ( args [ i ] ) ) <= int ( ' ' ) ) ) * totalChars = * totalChars + 1 ; else if ( ( int ( ' ' ) <= int ( args [ i ] ) && int ( args [ i ] ) <= int ( ' ' ) ) ) * totalDigits = * totalDigits + 1 ; else return false ; } return true ; }
Validate request from client; Count total characters and total digits.
Validate request from client ; Count total characters and total digits .