Advertisement
wendy890711

string練習

Apr 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8. int count=0;
  9. string s1 = "837AC6";
  10. string s2;
  11.  
  12. while (count<3)
  13. {
  14. cout << "請輸入密碼" << endl;
  15. cin >> s2;
  16.  
  17. if (s1.compare(s2) != 0)
  18. {
  19. cout << "請重新輸入密碼" << endl;
  20. count++;
  21. }
  22. else
  23. {
  24. cout << "密碼正確" << endl;
  25. break;
  26. }
  27. }
  28.  
  29.  
  30.  
  31. if (count == 3)
  32. cout << "忘記密碼??????" << endl;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement