fork download
  1. #include <iostream>
  2.  
  3. #include <fstream>
  4. #include <string>
  5. using namespace std;
  6.  
  7. string passwords[10000];
  8. int count = 0;
  9.  
  10. bool is_common(string password)
  11. {
  12. for (int i = 0; i < count; i++) {
  13. if (password == passwords[i]) {
  14. return true;
  15. }
  16. }
  17. return false;
  18. }
  19.  
  20. int main()
  21. {
  22. ifstream read("passwords.txt");
  23.  
  24. while (read >> passwords[count])
  25. {
  26. count++;
  27. }
  28.  
  29. string password;
  30. cout << "Please enter your password\n";
  31. cin >> password;
  32. if (is_common(password))
  33. {
  34. cout << "It is common\n";
  35. }
  36. else
  37. {
  38. cout << "It is not common\n";
  39. }
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 3468KB
stdin
12345ABCD
stdout
Please enter your password
It is not common