Question: Fill in the missing code as indicated. You will need these functions: - isalpha(arg): true if arg. is a letter, false otherwise - isdigit(arg): true

Fill in the missing code as indicated. You will need these functions: - isalpha(arg): true if arg. is a letter, false otherwise - isdigit(arg): true if arg. is a digit 0-9, false otherwise // This program tests a password for the American Equities // web page to see if the format is correct // Place Your Name Here #include  #include  #include  using namespace std; //function prototypes bool testPassWord(char[]); int countLetters(char*); int countDigits(char*); int main() { char passWord[20]; cout << "Enter a password consisting of exactly 5 " << "letters and 3 digits:" << endl; cin.getline(passWord, 20); if (testPassWord(passWord)) cout << "Please wait - your password is being verified" << endl; else { cout << "Invalid password. Please enter a password " << "with exactly 5 letters and 3 digits" << endl; cout << "For example, my37RuN9 is valid" << endl; } // Fill in the code that will call countLetters and // countDigits and will print to the screen both the number of // letters and digits contained in the password. return 0; } //************************************************************** // testPassWord // // task: determines if the word in the // character array passed to it, contains // exactly 5 letters and 3 digits. // data in: a word contained in a character array // data returned: true if the word contains 5 letters & 3 // digits, false otherwise // //************************************************************** bool testPassWord(char custPass[]) { int numLetters, numDigits, length; length = strlen(custPass); numLetters = countLetters(custPass); numDigits = countDigits(custPass); if (numLetters == 5 && numDigits == 3 && length == 8) return true; else return false; } // the next 2 functions are from Sample Program 10.5 //******************************************************************* // countLetters // // task: This function counts the number of letters // (both capital and lower case) in the string // data in: pointer that points to an array of characters // data returned: number of letters in the array of characters // //******************************************************************* int countLetters(char *strPtr) { int occurs = 0; while (*strPtr != '\0') // loop is executed as long as // the pointer strPtr does not point // to the null character which // marks the end of the string { //Fill in the code that counts the number of letters } return occurs; } //******************************************************************* // countDigits // // task: This function counts the number of digits // in the string // data in: pointer that points to an array of characters // data returned: number of digits in the array of characters // //******************************************************************* int countDigits(char *strPtr) { int occurs = 0; while (*strPtr != '\0') { //Fill in the code that counts number of digits } return occurs; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!