Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting expected unqualified-id error with C++ when trying to complie
    primarykey
    data
    text
    <p>I'm working on an assignment for class and keep getting an "expected unqualified-id" for the "{" after defining my bool types in the function. I can't figure out why I'm getting this error and it is making it hard to get my assignment done without being able to run my program. Can anyone tell me why I'm getting this error? Here is my code</p> <pre><code>//Page 825 Problem 12 #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; //Function Prototype bool testPassword(char []); const int passLength = 21; char password[passLength]; int main() { //Ask user to enter password matching the following criteria cout &lt;&lt; "Please enter a password at six characters long. \n" &lt;&lt; "Password must also contain at least one uppercase and one lowercase letter. \n" &lt;&lt; "Password must also contain at least one digit. \n" &lt;&lt; "Please enter your password now \n"; cin.getline (password, passLength); if (testPassword(password)) cout &lt;&lt; "Password entered is of the correct format and has been accepted."; else cout &lt;&lt; "Password does not meet criteria \n"; return 0; } //******************************* //**Function to test password *** //**to determine if it meets *** //**criteria listed *** //******************************* //Test password to determine if it is at least six characters long bool testPassword (char password[]); bool lower; bool upper; bool digit; bool length; { if (strlen(password) &lt; 6) length = true; else length = false; cout &lt;&lt; "Password must be at least 6 characters long.\n"; for (int k = 0; k &lt; passLength; k++) { if (islower(password[k]) lower = true; else lower = false; cout &lt;&lt; "Password must contain a lowercase letter.\n"; if (isupper(password[k]) upper = true; else upper = false; cout &lt;&lt; "Password must contain an uppercase letter.\n"; if (isdigit(password[k]) digit = true; else digit = false; cout &lt;&lt; "Password must contain a digit.\n"; } if (lower &amp;&amp; upper &amp;&amp; digit &amp;&amp; length == true) return true; else return false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload