visual c++ - C++ Help, Password Verifier -


sorry if sound idiot or code bad, need get. lot of people have written code did not want @ theirs , copy , paste. here's problem, when try running program, gives me identifier _tchar undefined, , gives me warning on line 20 " < signed/unsigned mismatch". again i'd love can get.

#include <iostream> #include <cstring>  using namespace std;   int main(int argc, _tchar* argv[])  {     const int size = 1000;      char password[size];      int count;      int times1 = 0;      int times2 = 0;      int times3 = 0;     cout << "please enter password: ";     cin.getline(password, size);       if (strlen(password) < 6){          cout << "not valid, password should atleast 6 letters";      }      (count = 0; count < strlen(password); count++)     {          if (isupper(password[count])) {              times1++;          }          if (islower(password[count])){              times2++;          }          if (isdigit(password[count])){              times3++;          }      }      if (times1 == 0) {          cout << "invalid, password should contain atleast 1 uppercase letter";      }      if (times2 == 0) {          cout << "invalid, password should contain atleast 1 lowercase letter";      }      if (times3 == 0) {          cout << "invalid, password should contain atleast 1 digit";      }        cin.get();     return 0; } 

wrap in while loop (from times1=0, times2=0, times3=0 before cin.get()). use bool variable called validpass , initialize true. when 1 of requirements fails make validpass=false. while should while(validpass==false){...}

#include "stdafx.h" #include <iostream> #include <cstring>  using namespace std;   int main()  {     const int size = 1000;      char password[size];      int count;      bool validpass;         {         validpass = true;         int times1 = 0;          int times2 = 0;          int times3 = 0;         cout << "please enter password: ";         cin.getline(password, size);           if (strlen(password) < 6){              cout << "not valid, password should atleast 6 letters";             validpass = false;             continue;          }          (count = 0; count < strlen(password); count++)         {              if (isupper(password[count])) {                  times1++;              }              if (islower(password[count])){                  times2++;              }              if (isdigit(password[count])){                  times3++;              }          }          if (times1 == 0) {              cout << "invalid, password should contain atleast 1 uppercase letter";             validpass = false;             continue;          }          if (times2 == 0) {              cout << "invalid, password should contain atleast 1 lowercase letter";             validpass = false;             continue;          }          if (times3 == 0) {              cout << "invalid, password should contain atleast 1 digit";             validpass = false;             continue;          }      } while (!validpass);          cin.get();     return 0; } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -