What I'm trying to accomplish is for the program to ask the user for their username and password and display it to the screen like this "John, abc123" after the function passwordCheck has confirmed that the password is not less then 5 characters. If the password is less then 5 characters long it keeps asking until its satisfied. The entire program keeps looping until the user enters 0 for username. Here is what I have.

Wow..... I would suggest you start by deciding where you want your inputs to occur. You have the password input occurring in 2 conflicting locations. You also have multiple occurrences of input for username. However, this is okay, the locations you have them in are complementary rather than conflicting.

Depending on what the assignment's instructions are, you may want to consider changing the return of passwordCheck to bool instead. You would then check the length of the string and return true or false depending on the results. You would then use this bool return value to control a validation loop in main().

Teacher wants me to change to a string function and use only one return with no bool. how to?

// function to check whether or not a password is valid
// has no spaces, doesn't use all digits
// is greater then 4 characters in length

bool CheckPassword(string password)
     bool valid=false;
     return false;
     for(int i = 0; i < password.length(); i++)
     if ((password[i]  >='A') && (password[i] <= 'Z') || (password[i]  >='a') && (password[i] <= 'z'))
     for(int i = 0; i < password.length(); i++)
     if(password[i]==' ')
     return false;
     return true;
     return false;