Getting expected unqualified-id error with C++ when trying to complie -


i'm working on assignment class , keep getting "expected unqualified-id" "{" after defining bool types in function. can't figure out why i'm getting error , making hard assignment done without being able run program. can tell me why i'm getting error? here code

//page 825 problem 12  #include <iostream> #include <string> using namespace std;   //function prototype bool testpassword(char []);  const int passlength = 21; char password[passlength];  int main() { //ask user enter password matching following criteria cout << "please enter password @ 6 characters long. \n" << "password must contain @ least 1 uppercase , 1 lowercase letter. \n" << "password must contain @ least 1 digit. \n" << "please enter password \n";  cin.getline (password, passlength);  if (testpassword(password))     cout << "password entered of correct format , has been accepted.";  else     cout << "password not meet criteria \n";   return 0; }  //******************************* //**function test password *** //**to determine if meets  *** //**criteria listed           *** //*******************************  //test password determine if @ least 6 characters long bool testpassword (char password[]);   bool lower; bool upper; bool digit; bool length;   {      if (strlen(password) < 6)         length = true;      else         length = false;         cout << "password must @ least 6 characters long.\n";   (int k = 0; k < passlength; k++) {     if (islower(password[k])         lower = true;     else         lower = false;         cout << "password must contain lowercase letter.\n";       if (isupper(password[k])         upper = true;     else         upper = false;         cout << "password must contain uppercase letter.\n";       if (isdigit(password[k])         digit = true;      else         digit = false;         cout << "password must contain digit.\n";  } if (lower && upper && digit && length == true)          return true;      else         return false; } 

testpassword: has ";" , end of line shouldn't have.

the bool variables need inside first "{", not before it.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

html - Repeat image to extend header to fill screen -

javascript - Backbone.js getting target attribute -