Question: I need help with my computer science course. I do not know why there is no response at all once I input data into char

I need help with my computer science course.

I do not know why there is no response at all once I input data into char passWord array.

I need help with my computer science course. I do not know

Below is my code:

#include

#include

#include

using namespace std;

bool testPassWord(char[]);

int countLetters(char*);

int countDigits(char*);

int main()

{

int numLetters, numDigits;

char passWord[20];

cout

cin.getline(passWord,20);

if(testPassWord(passWord))

cout

else

cout

numLetters = countLetters(passWord);

numDigits = countDigits(passWord);

cout

cout

return 0;

}

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;

}

int countLetters(char *strPtr)

{

int occurs = 0;

while(*strPtr != '\0')

{

if (isalpha(*strPtr))

{

occurs++;

strPtr++;

}

}

return occurs;

}

int countDigits(char *strPtr)

{

int occurs = 0;

while(*strPtr != '\0')

{

if (isdigit(*strPtr))

{

occurs++;

strPtr++;

}

}

return occurs;

}

Enter a password consisting of exactly 5 letters and 3 digits: kayle123

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!