BerryFox @ 2024-10-23 13:27:48
代码如下:
#include"bits/stdc++.h"
using namespace std;
const int MAXN=12+10;
bool have_lower_letter[MAXN],have_upper_letter[MAXN],have_number[MAXN],have_special_character[MAXN],licit[MAXN];
int password_len[MAXN],index=1,index2=1;
char g,password[20+10][100+10],diolog[100+10];
int main()
{
for(int i=1;i<=MAXN;i++)
{
licit[i]=true;
}
cin>>diolog;
for(int i=0;i<strlen(diolog);i++)
{
if(diolog[i]!=',')
{
password_len[index]++;
password[index][index2]=diolog[i];
index2++;
if(diolog[i]>=65&&diolog[i]<=90)
{
have_upper_letter[index]=true;
}
else if(diolog[i]>=97&&diolog[i]<=122)
{
have_lower_letter[index]=true;
}
else if(diolog[i]>=48&&diolog[i]<=57)
{
have_number[index]=true;
}
else if(diolog[i]=='!'||diolog[i]=='@'||diolog[i]=='#'||diolog[i]=='$')
{
have_special_character[index]=true;
}
else
{
licit[index]=false;
}
}
else
{
index++;
index2=1;
}
}
for(int i=1;i<=index;i++)
{
if(licit[i])
{
if((have_upper_letter[i]&&have_lower_letter[i]&&have_special_character[i])||(have_upper_letter[i]&&have_number[i]&&have_special_character[i])||(have_lower_letter[i]&&have_number[i]&&have_special_character[i]))
{
for(int j=1;j<=password_len[i];j++)
{
cout<<password[i][j];
}
cout<<endl;
}
}
}
}
by _th_tw_on_ @ 2024-10-23 13:31:51
@BerryFox index
和函数重名了
by BerryFox @ 2024-10-24 12:44:56
@_th_twon 已AC,谢谢