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

341 30 王謙祐 作業 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions 20230223-quiz-basic
Submodule 20230223-quiz-basic added at 2f7719
39 changes: 39 additions & 0 deletions bingo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int a=0,b;
int bingo[5][5];
int number[25]={0};
srand(time(0));
for(int i=0;i<25;i++){
int pick;
do{
pick=rand()%25+1;
}while(number[pick-1]>0);

number[pick-1]++;

//cout<< pick <<" " ;
//a++;
//if(a>=5){
//cout <<"\n";
//a=0;
//}
}
int now=0;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
bingo[i][j]=number[now];
now++;
cout <<now;
}
}
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
//cout <<bingo[i][j];
}
//cout<<"\n";
}
}

51 changes: 51 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <iostream>
using namespace std;
int main() {
int a,b,c=0,all_1=0,all_2=0,all_3=0,all_4=0,all;
char d,e,g;
string f,k;
cout <<"請輸入帳號:";
cin >> f;
if(f[0]!='a'){
cout << "帳號不符合";
return 0 ;
}
if(f[0]=='a'){
for(int i=1;i<=6;i++){
if(f[i]<'0' || f[i]>'9'){
cout <<"帳號不符合";
return 0;
}
}
if(f[7]!='@' || f[8]!='g'||f[9]!='m'||f[10]!='a'||f[11]!='i'||f[12]!='l'||f[13]!='.'||f[14]!='c'||f[15]!='o'||f[16]!='m'){
cout <<"帳號不符合";
return 0;
}
cout <<"請輸入密碼:";
cin >> k;
for(int i=0;i<20;i++){
if(k[i]>'0'&& k[i]<'9'){
all_4=1;
continue;
}
else if(k[i]>'a'&& k[i]<'z'){
all_1=1;
continue;
}
else if(k[i]>'A'&& k[i]<'Z'){
all_2=1;
continue;
}
else {
all_3=1;
}
if(i<=8 && k[i]=='\0'){
cout <<"密碼不安全";
return 0;
}
}
all=all_1+all_2+all_3+all_4+1;
cout << "密碼強度:"<< all <<"\n";
cout << "密碼安全";
}
}