From 94bce4cafadc334e39260181d48307afbf5e44f3 Mon Sep 17 00:00:00 2001 From: IaintHamburger Date: Wed, 1 Mar 2023 22:01:26 +0800 Subject: [PATCH] =?UTF-8?q?Create=20=E5=8D=97=E5=B1=B1gmail.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\345\215\227\345\261\261gmail.cpp" | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 "\345\215\227\345\261\261gmail.cpp" diff --git "a/\345\215\227\345\261\261gmail.cpp" "b/\345\215\227\345\261\261gmail.cpp" new file mode 100644 index 0000000..c9429d4 --- /dev/null +++ "b/\345\215\227\345\261\261gmail.cpp" @@ -0,0 +1,52 @@ +#include +#include +#include +using namespace std; + +int main() { + string gmail, password, ending, number; + int a = 0, c = 0, d = 0, e = 0, f = 0; + bool b = true; + cin >> gmail; + number = gmail.substr(1, 6); + ending = gmail.substr(7); + for (int i=0 ; i<6; i++){ + if ('0'<=number[i] && number[i]<='9'){ + a++; + } + } + if (a!=6 || gmail[0]!='a' || ending!="@gmail.com") { + cout << "不符合格式,重打\n"; + int a = 0; + cin >> gmail; + number = gmail.substr(1, 6); + ending = gmail.substr(7); + for (int i=0 ; i<6; i++){ + if ('0'<=number[i] && number[i]<='9'){ + a++; + } + } + a=0; + } + cout << "符合了,請輸入密碼\n"; + + cin >> password; + while(password.length()<8) { + cout << "失敗,因為長度太短,請重新輸入密碼\n"; + cin >> password; + } + for (int k=0; k