Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace std;
- void main()
- {
- int count=0;
- char account[] = "0076C048";
- char password[] = "123456";
- char a[50], p[50];
- while (count < 3)
- {
- cout << "請輸入帳號" << endl;
- cin >> a;
- cout << "請輸入密碼" << endl;
- cin >> p;
- int samea = strcmp(account, a);
- int samep = strcmp(password, p);
- if (samea == 0 && samep == 0)
- {
- cout << "帳號正確" << endl;
- cout << "密碼正確" << endl;
- cout << "登錄中..." << endl;
- break;
- }
- else if(samea==0&&samep!=0)
- {
- cout << "帳號正確" << endl;
- cout << "密碼錯誤" << endl;
- count++;
- }
- else if (samea != 0 && samep == 0)
- {
- cout << "帳號錯誤" << endl;
- cout << "密碼正確" << endl;
- count++;
- }
- else
- {
- cout << "帳號錯誤" << endl;
- cout << "密碼錯誤" << endl;
- count++;
- }
- }
- if(count==3)
- cout << "你是豬嗎?" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment