Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

33547 955460 登入系統vector版 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions 33547 955460 蕭華亨 登入系統vector版.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#include <iostream>
#include <vector>
using namespace std;
int main() {

int i = 0;
vector<string> name;
vector<string> secret;
bool test = false;
string change;
string sign;
string fill;
string newsign;
string newsecret;
string newpassword;
while(true){
cout << "請輸入帳號(若沒有帳號請輸入我要創建新帳號):";
cin >> sign;
if(sign == "我要創建新帳號"){
test = true;
cout << "請設定您的新帳號:";
cin >> newsign;
if(newsign != "我要創建新帳號"){
name.push_back(newsign);
cout << "請設定您的新密碼:";
cin >> newsecret;
secret.push_back(newsecret);
i += 1;
}else{
cout << "不可為系統內建功能文字!!!";
}
cout << "請輸入帳號(若沒有帳號請輸入我要創建新帳號):";
cin >> sign;
}
for(int a = 0; a < i; a++){
if(sign == name[a]){
test = true;
cout << "請輸入密碼:";
cin >> fill;
if(fill == secret[a]){
cout << "成功登入!";
cout << "是否修改密碼(按1為是,其他按鈕為否)";
cin >> change;
if(change == "1"){
cout << "請輸入您要修改的新密碼:";
cin >> newpassword;
secret[a] = newpassword;

}
change = '0';
break;
}else{
cout <<"帳號或密碼錯誤";
break;
}


}

}
if(test == false){
cout << "請輸入密碼:";
cin >> fill;
cout << "帳號或密碼錯誤";
}
test = false;


} }